Column balancing support in the region based multicol implementation
https://bugs.webkit.org/show_bug.cgi?id=116033

Source/WebCore:

Start by setting the column height to the flow thread's height divided
by the number of columns. Then stretch the column height until
contents fits without creating overflowing columns, or until the
maximum allowed column height is reached, whichever comes first. This
may require several layout iterations (but normally only a
couple). For each time we stretch, stretch by the least amount
required to make a difference to which box goes where.

Also make sure that the columns get tall enough to honor orphans
and widows settings.

This change takes some tiny steps in preparing for multiple column
set support. There is also some minor cleanup and bugfixing; see
details below.

Patch by Morten Stenshorne <mstensho@opera.com> on 2013-06-13
Reviewed by David Hyatt.

Tests: fast/multicol/newmulticol/balance-images.html
       fast/multicol/newmulticol/balance-maxheight1.html
       fast/multicol/newmulticol/balance-maxheight2.html
       fast/multicol/newmulticol/balance1.html
       fast/multicol/newmulticol/balance2.html
       fast/multicol/newmulticol/balance3.html
       fast/multicol/newmulticol/balance4.html
       fast/multicol/newmulticol/balance5.html
       fast/multicol/newmulticol/balance6.html
       fast/multicol/newmulticol/balance7.html
       fast/multicol/newmulticol/balance8.html
       fast/multicol/newmulticol/balance9.html
       fast/multicol/newmulticol/cell-shrinkback.html
       fast/multicol/newmulticol/columns-shorthand-parsing.html
       fast/multicol/newmulticol/orphans-and-widows-balance.html
       fast/multicol/newmulticol/single-line.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustForUnsplittableChild):
(WebCore::RenderBlock::setPageBreak):
(WebCore):
(WebCore::RenderBlock::updateMinimumPageHeight):
(WebCore::calculateMinimumPageHeight):
(WebCore::RenderBlock::adjustLinePositionForPagination):
(WebCore::RenderBlock::adjustBlockChildForPagination): If no lines
cross the boundaries, we need to report where blocks cross
instead, so that the column balancer knows how much to stretch
columns if necessary.
* rendering/RenderBlock.h:
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnBlock.cpp:
(WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock):
(WebCore::RenderMultiColumnBlock::checkForPaginationLogicalHeightChange):
(WebCore::RenderMultiColumnBlock::relayoutForPagination):
(WebCore::RenderMultiColumnBlock::layoutSpecialExcludedChild):
* rendering/RenderMultiColumnBlock.h:
(WebCore::RenderMultiColumnBlock::columnHeightAvailable):
(WebCore::RenderMultiColumnBlock::requiresBalancing):
(RenderMultiColumnBlock):
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::autoGenerateRegionsToBlockOffset):
(WebCore::RenderMultiColumnFlowThread::setPageBreak):
(WebCore):
(WebCore::RenderMultiColumnFlowThread::updateMinimumPageHeight):
* rendering/RenderMultiColumnFlowThread.h:
(RenderMultiColumnFlowThread):
* rendering/RenderMultiColumnSet.cpp: Get rid of
RenderMultiColumnSet::updateLogicalHeight() override. Make
RenderMultiColumnSet behave more like normal blocks, by having
computeLogicalHeight() calculate logical top in addition to
height, just like any other block.
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
(WebCore::RenderMultiColumnSet::heightAdjustedForSetOffset): This
method will become more meaningful once we add support for
multiple column sets.
(WebCore):
(WebCore::RenderMultiColumnSet::pageLogicalTopForOffset):
(WebCore::RenderMultiColumnSet::setAndConstrainColumnHeight):
(WebCore::RenderMultiColumnSet::calculateBalancedHeight):
(WebCore::RenderMultiColumnSet::recordSpaceShortage):
(WebCore::RenderMultiColumnSet::updateLogicalWidth):
(WebCore::RenderMultiColumnSet::prepareForLayout):
(WebCore::RenderMultiColumnSet::computeLogicalHeight):
(WebCore::RenderMultiColumnSet::columnCount):
(WebCore::RenderMultiColumnSet::columnIndexAtOffset):
repaintFlowThreadContent() could end up in an infinite loop
because columnIndexAtOffset() could return UINT_MAX
(subtracting 1 from unsigned 0, which columnCount() could return),
which an unsigned integer obviously can never become larger
than. Also always call columnIndexAtOffset() if we want to get the
column index for some offset, rather than doing it on our own
sometimes. To make this work also during layout, we cannot just
return the last column created so far if we're past it, since
adding new columns is exactly what we want to do at this point.
* rendering/RenderMultiColumnSet.h:
(RenderMultiColumnSet):

LayoutTests:

Patch by Morten Stenshorne <mstensho@opera.com> on 2013-06-13
Reviewed by David Hyatt.

* fast/multicol/newmulticol/balance-images-expected.txt: Added.
* fast/multicol/newmulticol/balance-images.html: Added.
* fast/multicol/newmulticol/balance-maxheight1-expected.txt: Added.
* fast/multicol/newmulticol/balance-maxheight1.html: Added.
* fast/multicol/newmulticol/balance-maxheight2-expected.txt: Added.
* fast/multicol/newmulticol/balance-maxheight2.html: Added.
* fast/multicol/newmulticol/balance1-expected.txt: Added.
* fast/multicol/newmulticol/balance1.html: Added.
* fast/multicol/newmulticol/balance2-expected.txt: Added.
* fast/multicol/newmulticol/balance2.html: Added.
* fast/multicol/newmulticol/balance3-expected.txt: Added.
* fast/multicol/newmulticol/balance3.html: Added.
* fast/multicol/newmulticol/balance4-expected.txt: Added.
* fast/multicol/newmulticol/balance4.html: Added.
* fast/multicol/newmulticol/balance5-expected.txt: Added.
* fast/multicol/newmulticol/balance5.html: Added.
* fast/multicol/newmulticol/balance6-expected.txt: Added.
* fast/multicol/newmulticol/balance6.html: Added.
* fast/multicol/newmulticol/balance7-expected.txt: Added.
* fast/multicol/newmulticol/balance7.html: Added.
* fast/multicol/newmulticol/balance8-expected.txt: Added.
* fast/multicol/newmulticol/balance8.html: Added.
* fast/multicol/newmulticol/balance9-expected.txt: Added.
* fast/multicol/newmulticol/balance9.html: Added.
* fast/multicol/newmulticol/cell-shrinkback-expected.html: Added.
* fast/multicol/newmulticol/cell-shrinkback.html: Added.
* fast/multicol/newmulticol/columns-shorthand-parsing-expected.html: Added.
* fast/multicol/newmulticol/columns-shorthand-parsing.html: Added.
* fast/multicol/newmulticol/orphans-and-widows-balance-expected.txt: Added.
* fast/multicol/newmulticol/orphans-and-widows-balance.html: Added.
* fast/multicol/newmulticol/single-line-expected.html: Added.
* fast/multicol/newmulticol/single-line.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][Mac] Disable QTKit video on OS X.
https://bugs.webkit.org/show_bug.cgi?id=117591

Reviewed by Tor Arne Vestbø.

Source/WebCore:

Deployment of the same Qt binaries to different
Mac OS X version makes it impossible to link against
the correct WebKitSystemInterface version at build time.

No new tests, no behavioural change.

* WebCore.pri:

Tools:

Deployment of Qt binaries to different Mac OS X
platform version makes it impossible to link against
the correct version of the WebKitSystemInterface library,
so we need to disable QTKit for media elements.

* qmake/mkspecs/features/features.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Background Blending] Gradients don't blend with any of the layers behind.
First, allow the layers behind opaque gradients to be drawn, then add the blending filters
when working with gradients.

Source/WebCore:

https://bugs.webkit.org/show_bug.cgi?id=117532

Patch by Mihai Tica <mitica@adobe.com> on 2013-06-13
Reviewed by Dirk Schulze.

Tests: css3/compositing/background-blend-mode-gradient-color.html
       css3/compositing/background-blend-mode-gradient-gradient.html
       css3/compositing/background-blend-mode-gradient-image.html
       css3/compositing/background-blend-mode-multiple-background-layers.html

* platform/graphics/GeneratorGeneratedImage.cpp:
(WebCore::GeneratorGeneratedImage::draw):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintFillLayers):

LayoutTests:

https://bugs.webkit.org/show_bug.cgi?id=117532
Patch by Mihai Tica <mitica@adobe.com> on 2013-06-13
Reviewed by Dirk Schulze.

* css3/compositing/background-blend-mode-gradient-color-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-color.html: Added.
* css3/compositing/background-blend-mode-gradient-gradient-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-gradient.html: Added.
* css3/compositing/background-blend-mode-gradient-image-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-image.html: Added.
* css3/compositing/background-blend-mode-multiple-background-layers-expected.txt: Added.
* css3/compositing/background-blend-mode-multiple-background-layers.html: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-color-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-gradient-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-image-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-multiple-background-layers-expected.png: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Setting overflow:hidden on position:absolute does not repaint hidden content
https://bugs.webkit.org/show_bug.cgi?id=116994

Patch by Yuki Sekiguchi <yuki.sekiguchi@access-company.com> on 2013-06-13
Reviewed by Simon Fraser.

Source/WebCore:

Since a container which has overflow clip of RenderBox which has self painting layer doesn't have a rect of the RenderBox as visual overflow,
the container should not clip request repainting rect of the RenderBox.

Test: fast/repaint/change-overflow-and-display-of-relative.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::shouldUseClipForRepaint): If this has self painting layer, we should not clip for repaint.
* rendering/RenderLayerModelObject.h:

LayoutTests:

* fast/repaint/change-overflow-and-display-of-relative-expected.txt: Added.
* fast/repaint/change-overflow-and-display-of-relative.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Avoid duplicate isInt32() / isUInt32() checks in JSDOMBindings
https://bugs.webkit.org/show_bug.cgi?id=117593

Reviewed by Geoffrey Garen.

Avoid duplicate isInt32() / isUInt32() checks in JSDOMBindings by
calling asInt32() / asUInt32() instead of toInt32() / toUInt32()
when we already know the value is a int32 / uint32.

No new tests, no behavior change.

* bindings/js/JSDOMBinding.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Unreviewed build correction.

* WebCore.vcxproj/WebCoreCairo.props: Use proper WebKit_Libraries
environment variable, rather than older WebKitLibraries.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Unreviewed build correction.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Add
missing symbols needed by TestWebKitAPI on WinCairo build.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [WK2] Found missing symbol when running some tests
https://bugs.webkit.org/show_bug.cgi?id=117598

Patch by Xabier Rodriguez Calvar <calvaris@igalia.com> on 2013-06-13
Reviewed by Martin Robinson.

* Source/autotools/symbols.filter: Added missing
_ZN7WebCore28notImplementedLoggingChannelEv.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Regions auto-height and absolute positioning bug
https://bugs.webkit.org/show_bug.cgi?id=111092

Patch by Anton Obzhirov <a.obzhirov@samsung.com> on 2013-06-13
Reviewed by David Hyatt.

During last layout that should update the auto-height regions new auto-height region height
is calculated correctly based on the text content, but it requires extra step
to reposition the render block after new logical height is set (correct logical height becomes
available only during last layout).

Tests: fast/regions/autoheight-abspos-bottom-align.html

* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::updateLogicalHeight):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] -webkit-background-clip: text; does not clip the background in regions
https://bugs.webkit.org/show_bug.cgi?id=117566

Reviewed by Alexandru Chiculita.

Source/WebCore:

This patch enables -webkit-background-clip: text; on regions.

Test: fast/regions/webkit-background-clip-text.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::paintFlowThreadPortionInRegion):
    Force black text if we're in the text clip paint phase. This makes sure the text's alpha
    channel does not affect the final opacity of the background clipping result. Rather,
    the text's alpha channel affects the amount of blending between the text color
    and the background.
* rendering/RenderRegion.cpp:
(WebCore::shouldPaintRegionContentsInPhase):
    Factor out a function to check if we should paint the region contents in a particular
    phase. Add "PaintPhaseTextClip" so that we draw the contents in the text clipping phase.
(WebCore::RenderRegion::paintObject):
    Call shouldPaintRegionContentsInPhase instead of doing the phase checks directly in this
    function. Move, update, and clarify the surrounding comments.

LayoutTests:

* fast/regions/webkit-background-clip-text-expected.html: Added.
* fast/regions/webkit-background-clip-text.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Optimize String::fromUTF8 for ASCII
https://bugs.webkit.org/show_bug.cgi?id=117586

Reviewed by Brent Fulgham.

From Blink r152243 by <abarth@chromium.org>

Current String::fromUTF8() implementation converts 8 bit ASCII character into 16 bit.
Instead of always trying to convert into a 16 bit buffer, we can add a call to charactersAreAllASCII.
In the common case when characters are ASCII, we directly copy it into an 8 bit string buffer.

* wtf/text/WTFString.cpp:
(WTF::String::fromUTF8):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151556 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Revise WebKit project to show generated export definition file.
https://bugs.webkit.org/show_bug.cgi?id=109629

Reviewed by Mark Rowe.

* WebKit.vcxproj/WebKit/WebKit.vcxproj: Add generated file.
* WebKit.vcxproj/WebKit/WebKit.vcxproj.filters: Ditto


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Avoid unwanted thread hops in ScriptProcessorNode when 'onaudioprocess' listener is not set.
https://bugs.webkit.org/show_bug.cgi?id=117578.

Patch by Praveen R Jadhav <praveen.j@samsung.com> on 2013-06-13
Reviewed by Darin Adler.

ScriptProcessorNode process operation continues to dispatch AudioProcessingEvent
even though 'onaudioprocess' listener is not set. This results in unwanted thread hops.
Code is optimized to dispatch AudioProcessingEvent only if the listener is set.

No new tests, already covered by existing tests.

* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
(WebCore::ScriptProcessorNode::process):
(WebCore::ScriptProcessorNode::setOnaudioprocess):
* Modules/webaudio/ScriptProcessorNode.h:
(WebCore::ScriptProcessorNode::onaudioprocess):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed gardening.

* WTF.vcxproj/WTF.vcxproj: Add FeatureDefines.h to visible files.
* WTF.vcxproj/WTF.vcxproj.filters: Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed gardening.  Remove dangling 'strings' folder from solution.

* WebCore.vcxproj/WebCore.vcxproj.filters: Get rid of 'strings' that was orphaned by
recent file reorganization.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Correct FeatureDefines.h Default for ENABLE_VIEW_MODE_CSS_MEDIA
https://bugs.webkit.org/show_bug.cgi?id=114396

Reviewed by Dean Jackson.

* wtf/FeatureDefines.h: The WinCairo port does not (currently) support Media elements,
so make sure we do not enable this feature by default for that port.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Revert r150339 since it causes a hang while paused in the Web Inspector in other apps.

https://bugs.webkit.org/show_bug.cgi?id=117596

Reviewed by Joseph Pecoraro.

* platform/mac/EventLoopMac.mm:
(WebCore::EventLoop::cycle):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support byte and octet types in bindings generators
https://bugs.webkit.org/show_bug.cgi?id=117547

Reviewed by Kentaro Hara.

Source/WebCore:

Add support for byte and octet IDL types to the bindings
generator:
http://dev.w3.org/2006/webapi/WebIDL/#idl-byte
http://dev.w3.org/2006/webapi/WebIDL/#idl-octet

No new tests, covered by existing layout tests and by new
bindings tests.

No new tests, covered by bindings tests and:
fast/js/webidl-type-mapping.html

* WebCore.exp.in: Export new symbols for mac port.
* bindings/js/JSDOMBinding.cpp:
* bindings/js/JSDOMBinding.h: Add toInt8() / toUInt8()
methods to convert from JSValue to int8_t / uint8_t as
specified by Web IDL.

* bindings/js/JSDataViewCustom.cpp: Remove custom code for
getInt8, getUInt8, setInt8, setUInt8 now that byte and octet
types are supported by the bindings generator.

* bindings/scripts/CodeGeneratorCPP.pm:
* bindings/scripts/CodeGeneratorGObject.pm:
* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/CodeGeneratorObjC.pm:
* bindings/scripts/test/CPP/WebDOMTestObj.cpp:
* bindings/scripts/test/CPP/WebDOMTestObj.h:
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
* bindings/scripts/test/TestObj.idl: Add tests for byte and octet types.
* html/canvas/DataView.idl: Remove [Custom] extended attribute for
getInt8, getUInt8, setInt8, setUInt8 and use newly supported byte / octet
types.

LayoutTests:

Update fast/js/webidl-type-mapping.html to cover byte and octet
Web IDL types with and without [EnforceRange].

* fast/js/webidl-type-mapping-expected.txt:
* fast/js/webidl-type-mapping.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Headers and footers should be pinned to the left edge of the window when scrolling 
horizontally, even when zoomed
https://bugs.webkit.org/show_bug.cgi?id=117562
-and corresponding-
<rdar://problem/14006745>

Reviewed by Sam Weinig.

We really want to use the width value from scrollOffsetForFixedPosition() for the 
banner with a scaled factor of 1. So if there is a different scale factor, re-
compute this value specifically for the banners. 
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Updating the -webkit-background-blend-mode property dynamically does not trigger a redraw of the element.

Source/WebCore:

Adding krit's fix: actual blending values should be compared, not the sets.
https://bugs.webkit.org/show_bug.cgi?id=117223

Patch by Mihai Tica <mitica@adobe.com> on 2013-06-13
Reviewed by Dirk Schulze.

Test: css3/compositing/background-blend-mode-image-color-dynamic.html

* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::operator==):

LayoutTests:

Adding test that sets background blend modes from script, after the page is loaded.
https://bugs.webkit.org/show_bug.cgi?id=117223

Patch by Mihai Tica <mitica@adobe.com> on 2013-06-13
Reviewed by Dirk Schulze.

* fast/repaint/background-blend-mode-image-color-dynamic-expected.html: Added.
* fast/repaint/background-blend-mode-image-color-dynamic.html: Added.

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