Maximum scroll position can be negative in some cases
https://bugs.webkit.org/show_bug.cgi?id=118175
<rdar://problem/14301217>

Reviewed by Anders Carlsson.

Test (API): WebKit2.ResizeReversePaginatedWebView

* page/FrameView.cpp:
(WebCore::FrameView::maximumScrollPosition):
* page/FrameView.h:
Override maximumScrollPosition() in FrameView and don't clamp to zero if
a reverse pagination mode is enabled, as it is possible (and common) to
have a negative maximum scroll position with reverse pagination.

* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):
Drive-by adoption of toIntSize().

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/ResizeReversePaginatedWebView.cpp: Added.
(TestWebKitAPI::didRunJavaScript):
(TestWebKitAPI::didLayout):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/lots-of-text-vertical-lr.html: Added.
Add a test that loads a vertical-lr document, paginates it horizontally
from right to left, resizes the view to fit the entire document, and
verifies that the scroll position is negative, as it must be for the
document to be enclosed by the view.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[wk2] TiledCoreAnimationDrawingArea should support scrolling its exposed rect
https://bugs.webkit.org/show_bug.cgi?id=118173
<rdar://problem/14301166>

Reviewed by Anders Carlsson.

Offset the exposed rect passed from the WKView by the main frame's current scroll position
before sending it to our TiledBackings, so that it is in the same coordinate space as their
ordinary visibleRects.

This has the side effect of making clips-to-exposed-rect testable (though useless) in Safari.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
Add updateScrolledExposedRect() and m_scrolledExposedRect.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::scroll):
Call updateScrolledExposedRect when the main frame scrolls.

(WebKit::TiledCoreAnimationDrawingArea::setExposedRect):
Remove a FIXME about this change.
Call updateScrolledExposedRect instead of passing down the unscrolled rect.

(WebKit::TiledCoreAnimationDrawingArea::setClipsToExposedRect):
Call updateScrolledExposedRect, because that method will short-circuit if
setClipsToExposedRect is false, so we need to update here for correctness
if we get a setExposedRect(), setClipsToExposedRect(true) pair.

(WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
Update m_scrolledExposedRect and propagate it to our TiledBackings.

(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
(WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
(WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
Use the scrolled exposed rect.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152266 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Link to WebInspectorUI.framework at build time instead of soft linking.

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

Reviewed by Joseph Pecoraro.

.:

* Source/Makefile: Build WebInspectorUI before WebKit and WebKit2.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

* Configurations/WebKit.xcconfig:
* WebCoreSupport/WebInspectorClient.mm:
(useWebKitWebInspector):

Source/WebKit2:

* Configurations/WebKit2.xcconfig:
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::inspectorReallyUsesWebKitUserInterface):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/mac/WebInspectorMac.mm:
(WebKit::inspectorReallyUsesWebKitUserInterface):

Tools:

* Scripts/build-webkit: Build WebInspectorUI before WebKit and WebKit2.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixed unreachable return when GLX or EGL are used with WebGL.
https://bugs.webkit.org/show_bug.cgi?id=118263

Reviewed by Noam Rosenthal.

* platform/graphics/opengl/GLPlatformContext.cpp:
(WebCore::createOffScreenContext): Fixed unreachable return.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DrawingBuffer constructor and destructor were not defined for Windows.
I moved duplicate code from Cairo and Qt to DrawingBuffer.cpp to be used by Qt, Cairo, and Windows.
https://bugs.webkit.org/show_bug.cgi?id=118262

Reviewed by Dean Jackson.

* platform/graphics/cairo/DrawingBufferCairo.cpp: Removed duplicate DrawingBuffer constructor and destructor.
* platform/graphics/gpu/DrawingBuffer.cpp:
(WebCore::DrawingBuffer::DrawingBuffer):
(WebCore::DrawingBuffer::~DrawingBuffer): Moved from Cairo and Qt implementation.
* platform/graphics/gpu/qt/DrawingBufferQt.cpp: Removed duplicate DrawingBuffer constructor and destructor.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Clean up private browsing session tracking
        https://bugs.webkit.org/show_bug.cgi?id=118266
        <rdar://problem/13078036>

        Reviewed by Brady Eidson.

        Instead of counting API calls, we now watch actual WebPreferences objects.

        * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPrivateBrowsingEnabled):
        Removed code that used to notify WebContext. It's now done by WebPreferences.

        * UIProcess/WebContext.h:
        * UIProcess/WebContext.cpp:
        (WebKit::WebContext::ensureNetworkProcess): Instead of counting the number of times
        API was called, rely on WebPreferences tracking.
        (WebKit::WebContext::willStartUsingPrivateBrowsing): Ditto. This function is
        now only called when we detect a change in private browsing state.
        (WebKit::WebContext::willStopUsingPrivateBrowsing): Ditto.
        (WebKit::WebContext::createNewWebProcess): Tell the new process to create a private
        browsing session if needed.

        * UIProcess/WebPreferences.h:
        * UIProcess/WebPreferences.cpp:
        (WebKit::WebPreferences::addPageGroup): Count how many page groups use private
        browsing, and notify WebContext when a session is needed. Note that we don't notify
        WebContext about WebPreferences without any page groups, because it's likely
        that preferences will be updated by the client before groups are associated.
        (WebKit::WebPreferences::removePageGroup): Ditto.
        (WebKit::WebPreferences::updateBoolValueForKey): Perform special handling for
        private browsing mode changes.
        (WebKit::WebPreferences::updatePrivateBrowsingValue): Notify WebContext when
        it's time to create or destroy a private browsing session.
        (WebKit::WebPreferences::anyPageGroupsAreUsingPrivateBrowsing): A getter for
        WebContext to know when any page groups are in private browsing mode.

        * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences):
        Don't create a private browsing session implicitly, UI process takes care of it.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Remove unsupported AC backends
https://bugs.webkit.org/show_bug.cgi?id=117362

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2013-07-01
Reviewed by Martin Robinson.

.:

* Source/autotools/FindDependencies.m4: remove checks related to acceleration backend,
turn them into a check for OpenGL being available, simply.
* Source/autotools/ReadCommandLineArguments.m4: remove command line option to select
accelerated backend, it's now auto-detected.
* Source/autotools/SetupAutoconfHeader.m4: no longer defines USE_CLUTTER and
USE_TEXTURE_MAPPER_CAIRO.
* Source/autotools/SetupAutomake.m4: remove checks related to acceleration backend,
turn them into a check for OpenGL being available, simply.
* Source/autotools/Versions.m4: no longer check for clutter/clutter-gtk.

Source/WebCore:

* GNUmakefile.am:
* GNUmakefile.list.am:
* Source/WebCore/platform/graphics/PlatformLayer.h: Removed mentions of clutter
and the texmap cairo backend.
* platform/graphics/clutter/DrawingBufferClutter.cpp: Removed.
* platform/graphics/clutter/GraphicsContext3DClutter.cpp: Removed.
* platform/graphics/clutter/GraphicsContext3DPrivate.cpp: Removed.
* platform/graphics/clutter/GraphicsContext3DPrivate.h: Removed.
* platform/graphics/clutter/GraphicsLayerActor.cpp: Removed.
* platform/graphics/clutter/GraphicsLayerActor.h: Removed.
* platform/graphics/clutter/GraphicsLayerClutter.cpp: Removed.
* platform/graphics/clutter/GraphicsLayerClutter.h: Removed.
* platform/graphics/clutter/PlatformClutterAnimation.cpp: Removed.
* platform/graphics/clutter/PlatformClutterAnimation.h: Removed.
* platform/graphics/clutter/PlatformClutterLayerClient.h: Removed.
* platform/graphics/clutter/TransformationMatrixClutter.cpp: Removed.
* Source/WebCore/platform/graphics/transforms/TransformationMatrix.h: Removed cogl
matrix type conversion.

Source/WebKit/gtk:

* GNUmakefile.am:
* WebCoreSupport/AcceleratedCompositingContext.h: removed clutter and cairo
additions.
* WebCoreSupport/AcceleratedCompositingContextCairo.cpp: Removed.
* WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Removed.
* webkit/webkitglobals.cpp:
(webkitInit): removed clutter-gtk initialization.

Tools:

* gtk/jhbuild-optional.modules: no longer needs clutter-gtk, clutter
and cogl, so removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Windows should be included in the list of platforms that can use OpenGL ES 2.
https://bugs.webkit.org/show_bug.cgi?id=118264

Reviewed by Dean Jackson.

* platform/graphics/GraphicsContext3D.h: Added PLATFORM(WIN) to platforms using OpenGL ES 2.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Efl][Gtk] Look at WEBKIT_OUTPUTDIR instead of WEBKITOUTPUTDIR in jhbuildrc
https://bugs.webkit.org/show_bug.cgi?id=118267

Patch by Nick Diego Yamane <nick.yamane@openbossa.org> on 2013-07-01
Reviewed by Gyuyoung Kim.

After r152226 (from https://bugs.webkit.org/show_bug.cgi?id=117249)
WEBKIT_OUTPUTDIR should be used instead of WEBKITOUPUTDIR. However
Efl's jhbuildrc is still using the WEBKITOUTPUTDIR environment variable.

* efl/jhbuildrc:
* gtk/jhbuildrc:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[JSC]: Fix maybe-uninitialized gcc 4.8 warning in DFGSpeculativeJIT.cpp
https://bugs.webkit.org/show_bug.cgi?id=118278

Patch by Sergio Correia <sergio.correia@openbossa.org> on 2013-07-01
Reviewed by Filip Pizlo.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
Initialize valueGPR with InvalidGPRReg.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS-Regions] OverrideLogicalHeight used by both regions and flexbox
https://bugs.webkit.org/show_bug.cgi?id=118057

Patch by Catalin Badea <badea@adobe.com> on 2013-07-02
Reviewed by David Hyatt.

Source/WebCore:

Remove the use of overrideLogicalContentHeight() from regions and
use a local variable instead. The change was needed to avoid
overlapping with flexbox containers.

Test: fast/regions/autoheight-flexbox.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::layout):
(WebCore::RenderFlowThread::applyBreakAfterContent):
(WebCore::RenderFlowThread::initializeRegionsComputedAutoHeight):
(WebCore::RenderFlowThread::updateRegionsFlowThreadPortionRect):
(WebCore::RenderFlowThread::addForcedRegionBreak):
* rendering/RenderFlowThread.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::RenderRegion):
(WebCore::RenderRegion::pageLogicalHeight):
(WebCore::RenderRegion::logicalHeightOfAllFlowThreadContent):
(WebCore::RenderRegion::updateRegionHasAutoLogicalHeightFlag):
(WebCore::RenderRegion::layoutBlock):
(WebCore::RenderRegion::updateLogicalHeight):
* rendering/RenderRegion.h:
(WebCore::RenderRegion::computedAutoHeight):
(WebCore::RenderRegion::setComputedAutoHeight):
(WebCore::RenderRegion::clearComputedAutoHeight):
(WebCore::RenderRegion::hasComputedAutoHeight):
* rendering/RenderView.cpp:

LayoutTests:

Add test for auto-height regions and flexbox containers.

* fast/regions/autoheight-flexbox-expected.html: Added.
* fast/regions/autoheight-flexbox.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][WK1] Support WebGL with EGL on Linux
https://bugs.webkit.org/show_bug.cgi?id=118251

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Let GraphicsContext3D work without a GraphicsSurface.

* Target.pri:
* platform/graphics/OpenGLShims.cpp:
(WebCore::getProcAddress):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):

Tools:

* qmake/mkspecs/features/features.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix cast-align warnings in WebCore/platform/graphics/texmap/TextureMapperGL.cpp
https://bugs.webkit.org/show_bug.cgi?id=118249

Reviewed by Allan Sandfeld Jensen.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::BitmapTextureGL::updateContents):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify SVGTextContentElement::elementFromRenderer()
https://bugs.webkit.org/show_bug.cgi?id=118284

Reviewed by Andreas Kling.

Simplify SVGTextContentElement::elementFromRenderer() by leveraging
SVGElement::isTextContent() methods instead of explicitly checking
for tag names.

No new tests, no behavior change.

* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::elementFromRenderer):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152284 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Introduce toSVGInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=118289

Reviewed by Andreas Kling.

As a step to change static_cast with toXXX, static_cast<SVGInlineTextBox*> can
be changed with toSVGInlineTextBox().

Blink merge from https://src.chromium.org/viewvc/blink?view=rev&revision=153345

* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::positionForPoint):
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::paintSelectionBackground):
(WebCore::SVGInlineFlowBox::paint):
(WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
* rendering/svg/SVGInlineTextBox.h:
(WebCore::toSVGInlineTextBox):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGInlineTextBoxes):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::paint):
(WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes):
(WebCore::SVGRootInlineBox::layoutChildBoxes):
(WebCore::reverseInlineBoxRangeAndValueListsIfNeeded):
* rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::collectTextBoxesInFlowBox):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152285 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unexpose EditingPropertiesToInclude in EditingStyle.h after r151772
https://bugs.webkit.org/show_bug.cgi?id=118271

Reviewed by Andreas Kling.

Don't expose EditingPropertiesToInclude in EditingStyle.h and do other cleanups as described below.

No new tests since there should be no behavioral change.

* editing/EditingStyle.cpp:
(WebCore::copyEditingProperties): Use newly defined numAllEditingProperties and numInheritableEditingProperties
instead of a magic number of 2.
(WebCore::copyPropertiesFromComputedStyle): Renamed from editingStyleFromComputedStyle. It now takes ComputedStyleExtractor and
PropertiesToInclude instead of Node* and EditingPropertiesToInclude and handles AllProperties. Also added a helper that takes Node*.
(WebCore::EditingStyle::init): Calls copyPropertiesFromComputedStyle. Unfortunately, we need to special-case EditingPropertiesInEffect
and not set background-color and text-decoration. This is required probably due to a bug elsewhere.
(WebCore::EditingStyle::removeStyleAddedByNode):
(WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
(WebCore::extractEditingProperties): Renamed from EditingStyle::removeAllButEditingProperties; takes PropertiesToInclude instead of
EditingPropertiesToInclude since the only caller of this function, EditingStyle::mergeInlineAndImplicitStyleOfElement, was converting
the type.
(WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
* editing/EditingStyle.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Skip 3 MathML tests that are failing after r152235.
<http://webkit.org/b/118298>

* TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Skip fast/dom/timer-throttling-hidden-page.html after r152202.
<http://webkit.org/b/118301>

* TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Avoid code duplication inside String::append()
https://bugs.webkit.org/show_bug.cgi?id=118290

Reviewed by Anders Carlsson.

The implementation of 'append(UChar)' had been repeated inside 'append(LChar)',
this duplication is obviated now.

* wtf/text/WTFString.cpp:
(WTF::String::appendInternal):
(WTF::String::append):
* wtf/text/WTFString.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152289 268f45cc-cd09-0410-ab3c-d52691b4dbfc
is/toHTMLStyleElement should use Element* for its argument
https://bugs.webkit.org/show_bug.cgi?id=118286

Reviewed by Andreas Kling.

To reduce unnecessary call of isElementNode(), this patch replaces argument
of is/toHTMLStyleElement from Node* to Element*. Plus, use Element::hasTagName
in collectActiveStyleSheets function for minor code refactoring since
its cost is cheaper than Node::hasTagName.

* css/CSSStyleSheet.cpp:
(WebCore::isAcceptableCSSStyleSheetParent):
* css/StyleScopeResolver.cpp:
(WebCore::StyleScopeResolver::scopeFor):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
* dom/Node.cpp:
(WebCore::Node::numberOfScopedHTMLStyleChildren):
* html/HTMLStyleElement.h:
(WebCore::isHTMLStyleElement):
(WebCore::toHTMLStyleElement):


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