Both <signal.h> and SA_RESTART usage are guarded behind ENABLE(JSC_MULTIPLE_THREADS).
But we cause a compile error if the platform doesn't support SA_RESTART regardless of
whether JSC_MULTIPLE_THREADS is enabled for the port. Instead, we shouldn't require
SA_RESTART support unless we are building with JSC_MULTIPLE_THREADS enabled.

Added the ability to profile the values seen at function calls (both
arguments and results) and heap loads. This is done with emphasis
on performance. A value profiling site consists of: add, and,
move, and store; no branching is necessary. Each value profiling
site (called a ValueProfile) has a ring buffer of 8 recently-seen
values. ValueProfiles are stored in the CodeBlock; there will be
one for each argument (excluding this) and each heap load or callsite.
Each time a value profiling site executes, it stores the value into
a pseudo-random element in the ValueProfile buffer. The point is
that for frequently executed code, we will have 8 somewhat recent
values in the buffer and will be able to not only figure out what
type it is, but also to be able to reason about the actual values
if we wish to do so.

This feature is currently disabled by default. When enabled, it
results in a 3.7% slow-down on SunSpider.

The chromium GPU configuration does not (currently) contain any tests
incompatible with --experimental-fully-parallel, and this flag is a
significan speedup because of the directory canvas/philip/tests which
contains 802 tests in the same directory. Setting this option by
default on this configuration is a 2x speed in release, 44s to 22s,
and a 3x speedup in debug, 223s to 77s, on linux on a 16 core machine.

WTF_USE_WK_SCROLLBAR_PAINTER is now WTF_USE_SCROLLBAR_PAINTER since WK no longer
applies.

wtf/Platform.h:

Source/WebCore:

Names changed to remove references to WebKitSystemInterface since the
implementation is now in WebCore. And the type names changed to be more Objective-
Cish instead of C++ish
WTF_USE_WK_SCROLLBAR_PAINTER -> WTF_USE_SCROLLBAR_PAINTER
WKScrollbarPainterRef -> ScrollbarPainter
WKScrollbarPainterControllerRef -> ScrollbarPainterController

Fixes crashes due to a bad cast from Image to BitmapImage on skia ports
that use BitmapImageSingleFrameSkia. In the skia port
Image::isBitmapImage() returning true does not necessarily mean that
Image is of type BitmapImage.

Covered by fast/canvas/canvas-as-image.html and many other canvas
tests.

Initially, when creating the style for the RenderFlowThread, overflowX and overflowY were both set to hidden,
so that RenderView did not display scrollbars when a RenderFlowThread exists. However, this allowed the possibility
of scrolling the content displayed in region.

Now, the RenderFlowThread objects are ignored in RenderBlock::insertPositionedObject and the style of the RenderFlowThread
can be set to visible, thus preventing scrolling of the content displayed in regions.

This patch makes QDesktopWebView delegate the decision of whether a navigation
should proceed to a slot in QML. The user of the DesktopWebView must implement a
'navigationPolicyForUrl()' if it wants to use the feature.

Such feature is useful for implementing opening links in "new tab" by using a
specific mouse button or mouse button plus keyboard modifiers.

The patch introduces a internal Qt-level interface called PolicyInterface, that
is used by QtWebPageProxy to delegate policy calls. A concrete implementation is
provided for QDesktopWebView.

Shared/qt/WebCoreArgumentCodersQt.cpp:

(CoreIPC::::encode):
(CoreIPC::::decode):
Implement the serialization of the Request URL, which is the only data
we exposing from the Request.

WebKit2.pro:

UIProcess/qt/PolicyInterface.h: Added.

UIProcess/qt/QtWebPageProxy.cpp:

(QtWebPageProxy::QtWebPageProxy):
(QtWebPageProxy::init):

UIProcess/qt/QtWebPageProxy.h:

Register a Policy Client in the WK2 C API only if there's a PolicyInterface available.

UIProcess/qt/ClientImpl.h:

UIProcess/qt/ClientImpl.cpp:

(toPolicyInterface):
(toQtMouseButton):
(toQtKeyboardModifiers):
(qt_wk_decidePolicyForNavigationAction):
Implement the callback for the Page Policy Client. It will translate the
arguments to Qt jargon and call PolicyInterface.

UIProcess/qt/qdesktopwebpageproxy.cpp:

(QDesktopWebPageProxy::QDesktopWebPageProxy):

UIProcess/API/qt/qdesktopwebview.h:

UIProcess/API/qt/qdesktopwebview_p.h:

UIProcess/API/qt/qdesktopwebview.cpp:

(toPolicyAction):
(hasMetaMethod):
(QDesktopWebViewPrivate::navigationPolicyForURL):
The concrete implementation for QDesktopWebView. Its private object implements
the PolicyInterface and try to call a possible function defined in QML (so return
value and arguments all QVariants). If there's no such a function, returns the
default UsePolicy, like if we haven't registered a PolicyClient in WK2 C API.

The gist of the issue is that we were ignoring calls to HTMLLinkElement::setDisabled that would enable a
style sheet when we were loading a stylesheet (m_sheet was 0 and thus ignored the call per the spec).

FF goes against the CSS OM spec in this case and always keep an associated sheet as long as 'rel' hints
at a stylesheet link and href is present. Instead of siding with FF, I continued to follow the
specification and store the enabled via javascript state into m_scriptState (renamed from
m_isEnabledViaScript). This information gets merged back into the style sheet disabled state when it is
available.

While debugging the case at hand, I found some cases that were not properly handled and were fixed as
part of this change.

html/HTMLLinkElement.cpp:

(WebCore::HTMLLinkElement::HTMLLinkElement): Updated after m_isEnabledViaScript rename.
(WebCore::HTMLLinkElement::setDisabled): Always call setIsEnabledViaScript so that
the information is properly stored (either for recalcStyleSelector or just to store
the state during loading).

(WebCore::HTMLLinkElement::sheetLoaded): Merge back the state from m_scriptState to
the sheet's disabled state.

(WebCore::HTMLLinkElement::disabled): Account for the temporary state and return the
right value. It matches FF and what people would expect.

(WebCore::HTMLLinkElement::areDisabledAndScriptStatesConsistent): Debug only method
that checks that disabled() and isEnabledViaScript() are consistent with each other
(under some circumstances).

LayerTilerChromium is renamed to be CCLayerTilingData. Invalidation
and paint functionality is pushed into TiledLayerChromium and drawing
with GL is pushed into CCTiledLayerImpl. During tree synchronization,
the tiler properties and texture IDs are synchronized into
CCTiledLayerImpl.

(closeUnusedFileDescriptors):
Check if a file descriptor is a kqueue and don't close it if that is the case. While this
isn't a complete fix, (it won't work if other initializers end up creating non-kqueue file descriptors)
it's good enough for Snow Leopard. For Lion, we should use the new posix_spawn API that lets you whitelist
file descriptors from the parent process.

Add ViewportInteractionEngine to handle the content of the viewport. The class make
sure the QTouchWebPage stays in the viewport and in the boundaries.

UIProcess/API/qt/qdesktopwebview.cpp:

(QDesktopWebViewPrivate::loadDidCommit):

UIProcess/API/qt/qdesktopwebview_p.h:

UIProcess/API/qt/qtouchwebpage.cpp:

(QTouchWebPage::QTouchWebPage): Set the transform origin to the top left so
we can asume the position 0, 0 is always the top left of the page.
(QTouchWebPagePrivate::_q_commitScaleChange): Make commitScaleChange a slot
in order to completely decouple the ViewportInteractionEngine and the WebKit classes.

(TestWebKitAPI::WebKitAgnosticTest::runWebKit1Test): Code came from
DynamicDeviceScaleFactor.WebKit.
(TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test): Code came from
DynamicDeviceScaleFactor.WebKit2.

markMisspellingsAndBadGrammar() was using markSpelling() and markBadGrammar().
But these are low-level API and caller should take care of word boundary.
This change replaced these call with overloaded version of markMisspellingsAndBadGrammar(),
which handles word boundary correctly.

There are functions in the API with multiple optional arguments.
When we call it we have to specify an optional argument as 'undefined' if we want to pass non default value for the next one.
This can be solved with passing the arguments as an object.

08/18/11:

Added a data member to LayerChromium and CCLayerImpl that holds
the screen-space transform. The transform is computed in
calculateDrawTransformsAndVisibility(), which is used during
updating (LayerChromium) and drawing (CCLayerImpl).

Also fixed a FIXME in LayerRendererChromium::drawLayer, which
was not computing the entire hierarchy of transforms to determine
back-face visibility. Now it simply uses the world space transform.

The problem here is that in RenderBox::paintMaskImages, if we are in
a transform with a rotation, scale or skew we set the composite mode to
be DestinationIn and then create a transparency layer, then paint the
mask with SourceOver and end the transparency layer. (The normal case
is just to use DestinationIn to paint the mask.)

In skia when we create transparency layers we don't pass on the composite
mode, so when we end the transparency layer it is composited back using
SourceOver. The fix is to pass on the composite mode when creating
transparency layers in skia.

Extracted EventDispatchMediator.h and EventDispatchMediator.cpp
out of Event.h and Event.cpp Also moved FocusEventDispatchMediator
and BlurEventDispatchMediator from Event.{h|cpp} to
EventDispatchMediator.{h|cpp}.

(WebCore::NewXMLDocumentParser::NewXMLDocumentParser):
(WebCore::NewXMLDocumentParser::resumeParsing):
(WebCore::NewXMLDocumentParser::processScript):
(WebCore::NewXMLDocumentParser::append): Add support for pausing the parsing
(WebCore::NewXMLDocumentParser::finish): Add support for pausing the parsing
(WebCore::NewXMLDocumentParser::notifyFinished):

xml/parser/NewXMLDocumentParser.h:

(WebCore::NewXMLDocumentParser::pauseParsing):

xml/parser/XMLTreeBuilder.cpp: Add a shared function between self-closing and end tags

Refactoring to put all allocations that need to be done after the object's
initialization list has executed but before the object is ready for use
into a separate constructorBody() method. This method is still called by the constructor,
so the patch doesn't resolve any potential issues, it's just to set up the code for further refactoring.

Refactoring to put all allocations that need to be done after the object's
initialization list has executed but before the object is ready for use
into a separate constructorBody() method. This method is still called by the constructor,
so the patch doesn't resolve any potential issues, it's just to set up the code for further refactoring.

This is a 1.3% win on Kraken overall, with >=8% speed-ups on a few
benchmarks (imaging-darkroom, stanford-crypto-pbkdf2,
stanford-crypto-sha256-iterative). It looks like it might have
a speed-up in SunSpider (though not statistically significant or
particularly reproducible) and a slight slow-down in V8 (0.14%,
not statistically significant). It does slow down v8-crypto by
1.5%.

The bug was caused by RenderText::positionForPoint's assuming that the position will always reside
inside the inline box that contains the point, which is not true at the boundaries of bidi-runs.

For example, in aDC12BAb where AB12CD is a RTL text, the offset on the right of A is 7 even though
the inline box for "BA" only contains offsets 1, 2, and 3. We must traverse the bidi-run "DC12BA"
until the end to obtain the offset 7 from the inline box for "DC".

Fixed the bug by introducing createVisiblePositionAfterAdjustingOffsetForBiDi which traverses runs
on the left or the right of the position to compute the appropriate offset following the NSTextView convention.

This patch also fixes a regression from r74971 that caret is placed incorrectly between inline boxes of
LTR or RTL text in a RTL or LTR block respectively.

Add new macros to SoftLinking.h to support soft-linking to functions and variables decorated with declspec(dllimport),
and use them to soft-link to AVFoundationCF and CoreMedia. I verified that the WebProcess doesn't load these DLLs
until a media element is used.

Fixed a bug in invalidateArea where it wouldn't properly invalidate overlay scrollbars. The problem was that it was assuming that the scrollbar was always to the right of the visible scrollbar. This isn't true for overlay scrollbars.

Handle the root or non-composited content with a GraphicsLayer rather than special case logic in
LayerRendererChromium. This layer's client is the NonCompositedContentHost, which routes the paint callbacks
through the LayerPainterChromium interface out to the WebView. The root layer is special in two ways:
*) The root layer has a scroll offset, which changes how the visibleLayerRect maps to content space and applies a

draw-time transform.

*) The root layer masks the alpha channel and disable blending when drawing because of concerns about subpixel

AA trashing the alpha channel. The root layer is always opaque so this is fine.

*) The root layer does not have border texels and does have subpixel AA for text.

(WebCore::CanvasRenderingContext2D::drawImage):
Removed the unnecessary dom exceptions for out of bounds source rectangles
The overloads that receive video and image elements as source images
now use the normalized versions of the source rectangle, which
GraphicsContext (and its various platform flavors) can handle correctly.
The normalized rectangle is the equivalent rectangle with width and height
greater than 0. The canvas version of this method, which had better layout
test coverage, was already correctly using the normalized rectangle. The
newly added layout test verifies correct behavior with negative
source rectangle dimensions.

platform/graphics/cg/GraphicsContextCG.cpp:

(WebCore::GraphicsContext::drawNativeImage):
Fixed algorithm that adjusts the destination rectangle to match the clipping
applied to the source rect. The case of scaled filtered images with source
rectangles that overlap the edge of the image was not being handled
correctly. This use case was previously unsupported and used to trigger
a DOM exception.

Added a test to ensure WebKit does not hit assertions in SimplifiedBackwardsTextIterator.
Also fixed a bug in first-letter-word-boundary.html and updated expected offsets for move backward by word
from 0 to 1 because there is unrendered space before "hello".

CCLayerTreeHostImplProxy now has public static methods isMainThread()
and isImplThread(), and we ASSERT these in various places. If threaded
compositing is disabled, we fake isImplThread() by setting a flag for
the duration of compositing, so the assert is still valid.

Add a bunch of accessors to WebAccessibilityObject to expose more of
AccessibilityObject to Chromium, including range control values,
document load state, live region attributes, and a few other
ARIA attributes.

This change introduces a smarter way of painting if the table is big enough and we have a small amount
of overflowing cells in the table. The new path does a binary search of the cells to repaint but adds
the overflowing cells to the repainting cells.

This saves ~50% when doing programmatic scrolling throught JS on a 500x100 table with some overflowing
cells. Also we cap the memory usage to a ratio of the total size of the table to avoid blowing up the
memory.

Reviewed by David Hyatt.

No new tests as the behavior should be the same.

rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::RenderTableSection):
(WebCore::RenderTableSection::layoutRows): Added some code to accumulate the overflowing cells
in an internal HashSet (we don't need to keep them sorted and it makes it easier to use them during
painting). If we hit the cap, flip the boolean value and clear the HashSet as the slow path does not
care about the cell's information. Make sure that the "has overflowing cells" information is still
properly encoded on our 2 values.

(WebCore::compareCellPositionsWithOverflowingCells): Added this method as we are doing a more
complicated sort:

the old path would sort one (mostly sorted) array by rows only as the stable sort would
take care of keeping the column ordering inside a row.

the new path basically has to sort an unsorted array (taken partly from the HashSet).

(WebCore::RenderTableSection::paintObject): Tweaked the logic to account for difference between
m_forceSlowPaintPathWithOverflowingCell and has some overflowing cells. Also we make sure we don't
repaint the same cell twice.

platform/gtk/RenderThemeGtk3.cpp:
(WebCore::RenderThemeGtk::adjustRepaintRect):
(WebCore::RenderThemeGtk::paintSliderTrack):
(WebCore::RenderThemeGtk::paintSliderThumb):
(WebCore::RenderThemeGtk::adjustSliderThumbSize): Now we have have
GTK_TYPE_SCALE in gtk+3.

​https://bugs.webkit.org/show_bug.cgi?id=61016
[WebWorkers][Chromium] Use v8 Isolates for in-process implementation of WebWorkers.
This adds an implementation of in-process dedicated workers to chromium port.
The crux of the matter is the reimplementation of WebWorkerClientImpl. WebWorkerClientImpl now
implements all three of Worker{Loader,Context,Object}Proxies and delegates the implementation to
WebKit's standard WorkerMessagingProxy.
For now, we have 3 implementations of workers in chromium WebKit:

In-process dedicated workers (this checkin)

Inter-process shared workers

Inter-process dedicated workers (defunct after this checkin)

This patch extracts some new common interfaces (NewWebWorkerBase and NewWebWorkerClient) for these
three implementations.
Removing the remainings of inter-process dedicated workers -related classes is left for a separate patch
(it will require coordinated changes on chromuium side).

Handle the root or non-composited content with a GraphicsLayer rather than special case logic in
LayerRendererChromium. This layer's client is the NonCompositedContentHost, which routes the paint callbacks
through the LayerPainterChromium interface out to the WebView. The root layer is special in two ways:
*) The root layer has a scroll offset, which changes how the visibleLayerRect maps to content space and applies a

draw-time transform.

*) The root layer masks the alpha channel when drawing because of concerns about subpixel AA trashing the alpha

channel. The root layer is always opaque so this is fine.

*) The root layer does not have border texels and does have subpixel AA for text.

Fixes <​http://webkit.org/b/66412> <rdar://problem/9971958> WebKit doesn't react when a
WebView is moved between windows with different backing scale factors

Reviewed by Anders Carlsson.

Source/WebKit/mac:

WebView/WebView.mm:

(-[WebView viewDidMoveToWindow]): Call setDeviceScaleFactor because our new window (or no
window at all) might have a different backing scale factor than the previous one.
(-[WebView _deviceScaleFactor]): Moved to the WebFileInternal category.

Source/WebKit2:

UIProcess/API/mac/WKView.mm:

(-[WKView viewDidMoveToWindow]): Call setDeviceScaleFactor because our new window (or no
window at all) might have a different backing scale factor than the previous one.
(-[WKView _deviceScaleFactor]): Moved to the new FileInternal category.

Tools:

Test that WebKit updates style when a WebView is moved between differently-scaled windows

TestWebKitAPI/JavaScriptTest.cpp:

(TestWebKitAPI::runJSTest): Moved a little bit of code from here...
(TestWebKitAPI::compareJSResult): ...to here. Also made the error message more similar to
gtest's built-in error messages.

TestWebKitAPI/JavaScriptTest.h: Added overloads of runJSTest that take a WebView * and

(-[FrameLoadDelegate initWithDidFinishLoadBoolean:]): Simple initializer.
(-[FrameLoadDelegate webView:didFinishLoadForFrame:]): Record that the load finished.
(TestWebKitAPI::didFinishLoadForFrame): Record that the load finished.
(TestWebKitAPI::setPageLoaderClient): Set up the client.
(TestWebKitAPI::DynamicDeviceScaleFactor::DynamicDeviceScaleFactor): Simple constructor.
(TestWebKitAPI::DynamicDeviceScaleFactor::createWindow): Creates a
SyntheticBackingScaleFactorWindow and returns it.
(TestWebKitAPI::DynamicDeviceScaleFactor::runTest): Loads devicePixelRatio.html and checks
that WebKit uses the correct scale factor when the WebView is not in a window, is put in a
window, is moved to a differently-scaled window, and is taken out of the window.
(TestWebKitAPI::DynamicDeviceScaleFactor::loadURL): Helper function with overloads for
WebKit1 and WebKit2.
(TestWebKitAPI::TEST_F): Runs the test, with overloads for WebKit1 and WebKit2.

The device scale factor is no longer considered part of WebPageProxy's "view state". It now
has its own setter/getter. This made the code a little simpler and more similar to the page
scale factor. Each port-specific WebKit2 view is now responsible for calling
WebPageProxy::setDeviceScaleFactor whenever it thinks the device scale factor might have
changed.

(WebKit::WebPageProxy::WebPageProxy): Initialize m_deviceScaleFactor.
(WebKit::WebPageProxy::viewStateDidChange): Removed device-scale-factor-related code.
(WebKit::WebPageProxy::setDeviceScaleFactor): Added. Records the new device scale factor and
tells the DrawingAreaProxy about it if it's actually changed.
(WebKit::WebPageProxy::creationParameters): Use m_deviceScaleFactor instead of calling out
to the PageClient.

UIProcess/WebPageProxy.h: Added m_deviceScaleFactor and setDeviceScaleFactor, which

The idle_quit_loop_cb() already checks the "load-status" flag, so it is enough to
call it only when the "load-status" change.

This change is important in the context of bug 28851, which aims to change the
order in which "progress finished" and "load finished" callbacks are called. In
this new scenario, at the progress callback the load will never be finished.

[Windows] editing/input/password-echo-passnode2.html, editing/input/password-echo-passnode3.html,
editing/input/password-echo-passnode.html, editing/input/password-echo-textnode.html
failing on Windows since they were added​https://bugs.webkit.org/show_bug.cgi?id=66461

Reviewed by Adam Roben.

Skip the above tests as window.textInputController is not supported on windows.

Added code that checks the parent RenderFlowThread of a RenderRegion and creates
a dependency for its referenced RenderFlowThread (from CSS style).

There are two cases:

A RenderRegion tries to display the flow thread that laid it out. In this case

the region will be ignored and will not participate in the flow threads regions list.

A RenderRegion tries to display a flow thread that contains another region that

tries to display the first region's flow thread. This one can be generalized with any
number of intermediate flow threads. In this case the recursion is detected and only the
first added region will actually be selected. The other region will be ignored. However,
when the recursion is removed the invalid regions will be recovered.

Patch by Alexandru Chiculita <​achicu@adobe.com> on 2011-08-18
Reviewed by David Hyatt.

This is a next step towards splitting SourceFile into RawSourceCode and UISourceCode.
UISourceCode is a part of SourceFile's interface that is visible to ScriptsPanel.
UISourceCode represents a single entry in scripts panel's files select.

Renamed the SVG-specific whitespace functions to call it "SVG space"
rather than just "whitespace". An alternative would have been to put
the functions into an SVG namespace instead of the top level WebCore
namespace.

Before beginning an explicit history navigation in a newly initialized
frame, it's important to give a "previous" item to avoid crashes, and
give a state to the state machine to avoid extra validating loads.

This is simply a cleanup change: there's no need that I can see for
HTMLFormControlElement and HTMLObjectElement to override
Element::attributeChanged since they can properly handle form
attribute changes in parseMappedAttribute, which they also override.

Though no change in behavior, I've added test coverage of the moved
code to an existing test (fast/forms/form-attribute.html) and added
a new test.

Test: fast/forms/radio-remove-form-attr.html

html/HTMLFormControlElement.cpp:

(WebCore::HTMLFormControlElement::parseMappedAttribute):

html/HTMLFormControlElement.h:

html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::parseMappedAttribute):

html/HTMLObjectElement.h:

LayoutTests:

Added new coverage to ensure that adding a radio button to a radio
group in the document by removing a form attribute leaves the group in
a valid state (no more than one button checked).

Beefed up coverage of form associated elements to better cover
HTMLObjectElement.

VisibleSelection returns a NoSelection to InsertTextCommand::doApply as
a new endingSelection, which isn't a sane state to be in. The code
tries to get a position on a higher node for a better selection, but
cannot go above the frameset (which exists in place of the body tag),
which lacks a renderer, and therefore cannot have a non-NoSelection
VisibleSelection.

Because this is a rare corner case, it seemed more reasonable to bail
out in this circumstance than to change the way VisibleSelection
canonicalization works. The new behavior is to delete the content, but
insert nothing. I investigated the possibility of trying to move above
or below the frameset in this particular case, but there still isn't a
renderer, so it didn't prevent the crash.

Test: editing/inserting/insert-text-into-empty-frameset-crash.html

editing/InsertTextCommand.cpp:

(WebCore::InsertTextCommand::doApply):

LayoutTests:

This test selects all and inserts text in a page which contains a frameset.
It tests for a crash caused by a NULL ptr which can occur in InsertText::doApply.

These modes cannot be passed straight through to the underlying graphics context as the graphics context
and the HTML5 canvas spec have different interpretations to them. In the graphics context, the compositing
modes are applied just over the area being filled. In the HTML5 spec, the compositing modes are applied over
the entire canvas.

The SourceIn, DestinationIn, SourceOut, DestinationAtop and Copy modes all need some kind of extra action
to just performing the composited fill on the canvas, as they need t he canvas to be cleared outside of the
area being filled.

Previous to this change the Copy mode did not do this clearing at all. The other modes did but if the
transformed path being filled contained anti-aliasing at its edges artifacts were introduced.

With this change, Copy now does a complete erase of the canvas before performing a fill as per normal.
The other modes use a temporary buffer just big enough for the transformed path (in device coordinates).
The fill is first done there in SourceOver mode. Then this is drawn into the canvas context using the
appropriate mode, with any areas outside the draw area being cleared.

Don't bother with SOFT_LINK_LIBRARY(libdispatch), we're going to continue to statically link to it since
the DLL will have already been loaded by other parts of AAS and is guaranteed to be available if AVFoundation
is enabled.

Use one shared GraphicsContext3D for the whole process instead of one per Page as canvases can move between
pages and directly draw into contexts in different pages. Also switches DrawingBufferChromium over to use a
directly shared the color attachment instead of copying it to a separate texture and removes the now-unnecessary
DrawingBuffer::didReset() call and WillPublishCallback mechanism.

(WebCore::applyBasicAuthorizationHeader): Apply the user/password from a credential to the HTTP headers for a request.
(WebCore::ResourceHandle::createCFURLConnection): Use the applyBasicAuthorizationHeader helper.
(WebCore::ResourceHandle::willSendRequest): If this is a redirect within the same origin, apply any stored target credentials to the new request.

platform/network/mac/ResourceHandleMac.mm:

(WebCore::applyBasicAuthorizationHeader): Apply the user/password from a credential to the HTTP headers for a request.
(WebCore::ResourceHandle::createNSURLConnection): Use the applyBasicAuthorizationHeader helper.
(WebCore::ResourceHandle::willSendRequest): If this is a redirect within the same origin, apply any stored target credentials to the new request.

LayoutTests:

These have to be in different paths to prevent credentials from leaking over from test to test.
Sad sad sad...

Merge 91736 - Source/WebCore: Removed support for the GL_latch_CHROMIUM extension which Chromium no longer supports.
Replaced calls to SetLatch with calls to Flush since Flush now has barrier semantics in Chromium.​https://bugs.webkit.org/show_bug.cgi?id=65043

If compositing is turned off during LayerRendererChromium::updateLayers(), the rootLayer() will become null.
Sicne CCLayerTreeHost::doComposite() calls updateLayers() and then drawLayers() without checking for this case,
drawLayers() has to return without doing anything if the root layer is null.

Crash fixed based on crash reports. No known reliably repro case, unfortunately.

This patch introduces a new view for displaying expect, actual, and
differences between results. The new view also has a fledgling
controller that handles some basic operations. The new view is
exercised by rebaseline.html, which lets you rebaselines expected
failures, but the new view is not fully integrated into
garden-o-matic.html

More patches will be required to make this stuff fully working, but
this patch was already somewhat spiraling out of control. Hopefully
this patch will serve as a good starting point for further development.

When node is getting destroyed and its removedFromDocument
is not called due to entire document structure torn down(using
removeAllChildren), make sure to clear out the stylesheet
candidate node from document's structures in its destructor.

Updated accessibilityTable to return level values consistent with other accessibilityObjects that
return level values. This means a value of 0 is now only returned when tableLevel() is called on a
non-table element.

Added the ability to get numeric attribute values using numberAttributeValue. This
function complements the existing stringAttributeValue and boolAttributeValue functions.
The addition of numberAttributeValue was necessary because the stringAttributeValue
function does a type check and will only return strings. This limitation made it
impossible to get values for attributes that returned an NSNumber.

This test ensures that all AccessibilityObjects that return a level value return consistent results.
For example, a level of 0 should only be returned by a level function when it is called on an
AccessibilityObject of the wrong type. It's especially important that we enforce this consistency
using layout tests because these level values are not defined by the W3C but are still used by
popular screen readers such as VoiceOver.

(Builder.prototype.getNumberOfFailingTests): If it looks like all tests passed, but
run-webkit-tests took less than 10 seconds to run, assume that some weird error occurred
that caused it not to run any tests at all (as happened for a while due to
<​http://webkit.org/b/64988>). Bumped the cache version to evict old, buggy cached data.

The bug was caused by willBeModified's always using block direction to determine
the direction to which the selection is collapsed. Fixed the bug by calling directionOfSelection
in willBeModified, which will return the text direction of the surrounding context when
the start and the end have the same direction. When the text directions at the start and at the end
of selection do not match, it uses the block's text direction.

Moved platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationCF.* files to platform/graphics/avfoundation/cf,
and moved platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.* files to platform/graphics/avfoundation/objc/.

While I was at it, added svn:eol-style property to the MediaPlayerPrivateAVFoundationObjC.* files.

Also, for some reason, Visual Studio decided to re-sort a couple files in \inspector\front-end\ in WebCore.vcproj, even though
I just re-sorted the project in r93215.

Reviewed by Eric Carlson.

No new tests; no functional change.

WebCore.vcproj/WebCore.vcproj: Moved platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationCF.* files to platform/graphics/avfoundation/cf.

WebCore.vcproj/WebCoreMediaQT.vsprops: Added $(ProjectDir)..\platform\graphics\avfoundation\cf to include paths.

WebCore.xcodeproj/project.pbxproj: Moved platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.* files to platform/graphics/avfoundation/objc/.

Add Windows results for tests that differ from Lion due to font differences

These tests started failing in r93107 when I made Windows fall back to Lion results instead
of SnowLeopard results. This is good in general, but these particular tests happen to give
SnowLeopard-ish results due to some fonts that changed in Lion.

Overlay scrollbars were not visible if the user scrolled a page while the page was loading. The sequence of events necessary to reproduce this bug were:

-[ScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:] is called

animation is delayed because shouldSuspendScrollAnimations() is true

ScrollAnimatorChromiumMac::scroll() is called before the ScrollAnimatorChromiumMac::m_initialScrollbarPaintTimer is fired.

At this point the scrollbar painter assumes the scrollbar is already visible (because of 1.) so the scrollbar's alpha stays at 0. Thus the scrollbar isn't visible until the page finishes loading.

It turns out that the root problem was that when the initialScrollbarPainterTimer fired I wasn't flashing the scrollbar correctly. My implementation of wkScrollbarPainterForceFlashScrollers() just called flashScrollers. The Safari implementation of this function also calls hideOverlayScrollers. Calling hideOverlayScrollers causes the alpha to change to 0 which prevents step 4 from happening.

Also, now that wkScrollbarPainterForceFlashScrollers is working correctly I don't need the extra logic I added to the initialScrollbarPainterTimer handler. That logic restarted the timer if shouldSuspendScrollAnimations() was true. But this isn't necessary since calling wkScrollbarPainterForceFlashScrollers() causes -[ScrollbarPainterDelegate setUpAnimation:...] to be called which does the exact same thing. Removing the extra logic reverts ​http://trac.webkit.org/changeset/92316.

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Support cast from TextOverflow to CSSPrimitiveValue.
(WebCore::CSSPrimitiveValue::operator TextOverflow):
Support cast from CSSPrimitiveValue to TextOverflow.

Test coming in a more comprehensive patch shortly. This is just a very targetted
patch to allow for easier merging.

loader/CrossOriginAccessControl.cpp:

(WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Add referer to the list
of whitelisted headers. It can't be set by xhr so it is ok to whitelist it, but it is
set before calling this function. This is similar to what is done for "origin" in here.

Test coming in a more comprehensive patch shortly. This is just a very targetted
patch to allow for easier merging.

loader/CrossOriginAccessControl.cpp:

(WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Add referer to the list
of whitelisted headers. It can't be set by xhr so it is ok to whitelist it, but it is
set before calling this function. This is similar to what is done for "origin" in here.

JIT::privateCompilePutByIdTransition expects that regT0 and regT1
have the basePayload and baseTag respectively. In some cases,
we may get to this generated code with one or both of these
registers trash. One know case is that regT0 on ARM may be
trashed as regT0 (r0) is also arg0 and can be overrun with sp due
to calls to JIT::restoreReturnAddress(). This patch uses the
values on the stack. A longer term solution is to work out all
cases so that the register entry assumptions can assured.

While fixing this, also determined that the additional stack offset
of sizeof(void*) is not needed for ARM.

Test coming in a more comprehensive patch shortly. This is just a very targetted
patch to allow for easier merging.

loader/CrossOriginAccessControl.cpp:

(WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Add referer to the list
of whitelisted headers. It can't be set by xhr so it is ok to whitelist it, but it is
set before calling this function. This is similar to what is done for "origin" in here.

Added a data member to LayerChromium and CCLayerImpl that holds
the screen-space transform. The transform is computed in
calculateDrawTransformsAndVisibility(), which is used during
updating (LayerChromium) and drawing (CCLayerImpl). This transform
will also be used for other things, such as HUD drawing, in upcoming
patches.

Also fixed a FIXME in LayerRendererChromium::drawLayer, which
was not computing the entire hierarchy of transforms to determine
back-face visibility. Now it simply uses the screen space transform.

WinPort didn't have any port_name parsing logic.
Seemed it was best to just share the logic from MacPort.
Sharing the logic from MacPort seemed easiest with a shared superclass.
Once I created ApplePort (the superclass) there was a bunch of logic to share.
I found LeakDetector was just in the way when switching back and forth
between win.py and mac.py so I moved it into its own file.

The only logic change here is that WinPort should now be
able to parse port_name values like MacPort (and other ports)
can. The fact that ports do this in their constructors is
wrong and a source of many bugs. But at least now WinPort
matches the status-quo.

In r93140 the temporary font created for a remote CSS font face
was created without being retained. We need to protect the
font from being purged while we hold onto it, so add a font cache
purge preventer.

This patch moves us closer to switching the Chromium port from
CoreGraphics to Skia. This patch teaches our tools that the current
Chromium Mac configuration is actually chromium-cg-mac, which makes
room for a future chromium-mac configuration that uses Skia.

Shortly after this patch lands, I'll do a server-side move of the
chromium-mac and chromium-mac-leopard directories to chromium-cg-mac
and chromium-cg-mac-leopard.

Canvas resizing was slow due to re-allocation of the ImageBuffer on
each size change (width or height). This was introduced inadvertently
by calls to isAccelerated() during canvas reset(). Since we won't
know if we have successfully accelerated until ImageBuffer creation,
move the compositor invalidation to createImageBuffer() as well.
This patch also attempts to unify the Skia and CG accelerated canvas
paths. The DrawingBuffer used by the Skia path is now owned by
ImageBuffer[Skia], similar to how the IOSurface is owned by
ImageBuffer[CG]. Some of the logic for when to accelerate was moved
into HTMLCanvasElement and unified with the CG path. Acceleration is
also now enabled by the same "Accelerated" ImageBuffer create flag
used by the CG path. DrawingBuffer is now re-created even for a
same-size change (same as the memory buffer), but we speed it up
by calling GraphicsContext3D::texImage2D() with a NULL pixels ptr
instead of GraphicsContext3D::teximage2DResourceSafe() (no need to
clear it, since it's done with a glClear anyway).

Reviewed by Kenneth Russell.

Covered by existing tests in fast/canvas and canvas/philip.

html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::reset):
Don't call isAccelerated() from reset(), since we don't want to
inadvertently create the ImageBuffer. Also, since we won't know if
we have successfully accelerated until createImageBuffer() is
called, defer the compositor invalidation to createImageBuffer() as
well.
(WebCore::HTMLCanvasElement::shouldAccelerate):
Unify the CG and Skia ports' logic for when to accelerate (Skia
logic moved in from CanvasRenderingContext2D).
(WebCore::HTMLCanvasElement::createImageBuffer):
Use the unified shouldAccelerate() logic, and pass it as a flag
to ImageBuffer. Do compositor invalidation as well.

(WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::~CanvasRenderingContext2D):
Remove all acceleration setting and resetting, since it's now done
during ImageBuffer creation.
(WebCore::CanvasRenderingContext2D::isAccelerated):
Check if the image buffer was created, so we don't inadvertently
create it here.
(WebCore::CanvasRenderingContext2D::paintsIntoCanvasBuffer):
Don't call GraphicsContext3D::paintsIntoCanvasBuffer(), since its
WebViewImpl may be null. Ask the render tree instead.
(WebCore::CanvasRenderingContext2D::reset):
Don't reset acceleration here, since we don't own it anymore.
(WebCore::CanvasRenderingContext2D::platformLayer):
Call into the ImageBuffer to get our PlatformLayer.

(WebCore::DrawingBuffer::reset):
Use texImage2D() with a NULL ptr, not texImage2DResourceSafe().
Since we immediately clear the framebuffer via glClear(), this whole
resource safe business is overkill.

platform/graphics/skia/GraphicsContextSkia.cpp:

Remove setGraphicsContext3D() and paintsIntoImageBuffer(). This
functionality is handled by ImageBuffer now.

platform/graphics/skia/ImageBufferSkia.cpp:

(WebCore::ImageBuffer::ImageBuffer):
Give the ImageBufferData ownership of the DrawingBuffer.
(WebCore::ImageBuffer::platformLayer):
Implement an accessor for the DrawingBuffer's PlatformLayer.

Teach TestFailures that tests that have failed or passed many times in a row are not flaky

The basic strategy here is that once a test has failed or passed many times in a row we
never again consider it as a possibly flaky test. It's a simple strategy but seems to result
in many fewer false positives than our current behavior.

Fixes <​http://webkit.org/b/66327> TestFailures page considers far too many tests to be
flaky, including tests that failed for a while but then were fixed

(FlakyLayoutTestDetector): Initialize new _buildCount property, which is used to track the
number of non-too-many-failure builds we've seen.
(FlakyLayoutTestDetector.prototype.incorporateTestResults): Don't track tests which haven't
failed in the _maximumFailOrPassCount most recent builds. For other not-yet-considered-flaky
tests, keep track of how many times they have passed or failed in a row. If they pass or
fail more than _maximumFailOrPassCount times, consider them to be non-flaky. (Once a test is
considered flaky it doesn't matter how many times it passes or fails.)

This just makes the troublesome enum public. If this
fixes the build I will file a follow-up bug to clean-up
these build issues and either keep the enum public and
cleanup other functions or restore the enum to private.
There is no harm in making the enum public right now.

Make region invalidation and repainting work properly. We do this by making RenderFlowThreads into
repaint containers and then issuing new repaints in the regions that contain the invalidated flow thread
content.

While a remote CSS font face is loading we fallback to a
temporary font. We don't want to retain the fallback font
because noone takes ownership of the temporary font. This
patch adds a way to get an uncached fallback font, which
plumbs the ShouldRetain enum through the different platform
implementations of getLastResortFallbackFont.

Make ScrollView::paintOverhangAreas() use the ScrollbarTheme::nativeTheme() to
draw the overhang areas.
Move default implementation to ScrollbarThemeComposite::paintOverhangAreas().
Add a different implementation for Chromium Mac.

Modified default value of VisibleSelection->m_isDirectional from 'true'
to 'false' by adding a defaulted argument to several VisibleSelection
constructors to make programmatic selection be directionless by default
on Mac. Also modified several calls to VisibleSelection's constructors
to correctly preserve directionality.

Near the end of FrameSelection::modify (presently FrameSelection.cpp:869)
a call to setExtent triggers an editing delegate that uses the
FrameSelection. The direction here should have been preserved from before,
but setIsDirectional was not called until after FrameSelection.cpp:869. It
has been moved up to make things behave.

Added editing/selection/programmatic-selection-on-mac-is-directionless
to test selection direction in programmatically set selections on
windows, unix, and mac, in plain text, editable divs, text-input
fields, and textareas. Modified text baselines for many editing tests,
which had a delegate change as a result of the cpp patch.

Allow the hostWindow param (and m_webViewImpl) to be NULL. This
makes it much easier to enable GPU acceleration at a lower level
in WebKit's platform/graphics layer, without needing access to the
Page* or HostWindow*. Also bump the chromium DEPS to chrome r96940,
which includes a similar change for the in-process GraphicsContext3D
implementations.

This reverts ​http://trac.webkit.org/changeset/89132 and introduces InspectorInstrumentation
calls from the CSSStyleSelector for pseudo state processing. These calls are very fast:
they are guarded with the inline checks for the front-end count.

Make ScrollView::paintOverhangAreas() use the ScrollbarTheme::nativeTheme() to
draw the overhang areas.
Move default implementation to ScrollbarThemeComposite::paintOverhangAreas().
Add a different implementation for Chromium Mac.

The only difference from the cross-platform results is that the .js resources are now given
a MIME type of "text/plain".

This test reloads the page before dumping it in HAR format. In Lion (and Safari 5.1 on
Windows), CFNetwork no longer uses the file extension as a fallback when determining the
MIME type for 304 cached responses. This matches Chrome. See <rdar://problem/9313303>.

(Builder.prototype.getNumberOfFailingTests): Look for "isFinished" in the layout-test step
rather than "isStarted" so that we don't count builds for which the test run never finished.
Bumped the cache version to evict old, buggy cached data.

(_should_file_trigger_build): Added an entry for the LayoutTests/platform/mac-lion
directory, which all Apple Mac platforms and Apple Win platforms could potentially use
results from. Removed Apple Win from being affected by mac-snowleopard changes, since it
will no longer look there for results.

Windows now fails these tests due to changes in ICU. Mac fails these tests, too, though in a
different way. Alexey tells me that these tests are silly because they check compliance with
a particular version of Unicode. Given this, it doesn't seem that a bug is required to track
this change in behavior.

Element::spellcheckAttributeState() uses Element::hasAttribute(),
which calls updateStyleAttribute(), which potentially makes style
dirty. But that is problematic since Editor calls spellcheckAttributeState()
during the spell-checking phase and make the style dirty,
which can trigger re-layout, which wipes the shadow tree of a textarea
out by pre-committed "value" text.

This change removes the hasAttribute() call from
spellcheckAttributeState().

This is a regression caused by r92922, which wrongly assumes that
a shadow host always has a shadow root as an immediate child in
ancestors chain. This assumption does not apply to <details>
element. <details> element is implemented as a shadow host, but
may have a <summary> element as an immediate child element in
ancestors chain.

The real composited results may be locked inside the compositor
context's version of a texture because the drawing buffer was
automatically cleared, so read from there to get the actual presented
version to draw.

No new tests since no change in behavior.
The original issue is only reproducible on Chromium in multi-process mode
and is tested there by a browsertest.

loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::transferLoadingResourcesFromPage):
Passing ResourceLoader* into the FrameLoaderClient notification.
Also, fixed the bug where the same ResourceRequest was passed for all subresources.

(WebCore::ResourceLoader::originalRequest): Added the originalRequest() accessor that
returns the request as it existed before redirects (but after client's will SendRequest).
This is to be able to pass the original request for loading subresources into
FrameLoaderClient::transferLoadingResourceFromPage, since that one is used to invoke
assignIdentifierToInitialRequest, which needs original request.

Added this new function. We recalc style so that, e.g., device-scale-factor-dependent media
queries will be reevaluated, and we tell compositing layers about the new scale factor so
they can rerender at the new resolution.

Source/WebKit/mac:

WebView/WebView.mm:

(-[WebView addWindowObserversForWindow:]):
(-[WebView removeWindowObservers]):
Listen for the notification that tells us the window's backing scale has changed.

(-[WebView _windowDidChangeResolution:]): Tell the page about the change to the device scale
factor so that, e.g., scale-factor-dependent media queries will be reevaluated.

Source/WebKit2:

UIProcess/API/mac/WKView.mm:

(-[WKView addWindowObserversForWindow:]):
(-[WKView removeWindowObservers]):
Listen for the notification that tells us the window's backing scale has changed.

(-[WKView _windowDidChangeResolution:]): Tell the WebPageProxy about the change.

UIProcess/DrawingAreaProxy.h:

UIProcess/DrawingAreaProxyImpl.h:

Added deviceScaleFactorDidChange.

UIProcess/DrawingAreaProxyImpl.cpp:

(WebKit::DrawingAreaProxyImpl::deviceScaleFactorDidChange): Request a new backing store
since the current one is using an old device scale factor.
(WebKit::DrawingAreaProxyImpl::sendUpdateBackingStoreState): Send the device scale factor
along to the web process so it can render accordingly. This is how we tell the web process
about device scale factor changes.

UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::viewStateDidChange): Tell the DrawingAreaProxy when the device scale
factor changes.
(WebKit::WebPageProxy::deviceScaleFactor): Added this simple getter that calls through to
the PageClient. DrawingAreaProxy uses this function.

UIProcess/WebPageProxy.h: Added new members.

WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::updateBackingStoreState):

WebProcess/WebPage/DrawingArea.messages.in:

WebProcess/WebPage/DrawingAreaImpl.h:

Send the device scale factor in the UpdateBackingStoreState message.

WebProcess/WebPage/DrawingAreaImpl.cpp:

(WebKit::DrawingAreaImpl::updateBackingStoreState): Tell the WebPage and LayerTreeHost about
the new device scale factor.

WebProcess/WebPage/LayerTreeHost.h:

WebProcess/WebPage/ca/LayerTreeHostCA.h:

Added deviceScaleFactorDidChange.

WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setDeviceScaleFactor): Store the new scale factor and tell the page about
it so that, e.g., scale-factor-dependent media queries will be reevaluated.

WebProcess/WebPage/WebPage.h: Added setDeviceScaleFactor.

WebProcess/WebPage/ca/LayerTreeHostCA.cpp:

(WebKit::LayerTreeHostCA::deviceScaleFactorDidChange): Tell the layer for non-composited
content about the new scale factor.

History swiping can only start after an unhandled mouse wheel event
came back from the renderer, because mouse wheel javascript handlers
take precedence over history swiping. This means that rubberbanding
must not consume wheel events if they could trigger history, else
history swiping won't be triggered for pages without wheel handlers
either.

This is based on the implementation in
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

(TestWebKitAPI::JavaScriptCallbackContext::JavaScriptCallbackContext): Removed now-unused
members.
(TestWebKitAPI::javaScriptCallback): Changed to just store the result string in the context
object, rather than doing any testing of it here.
(TestWebKitAPI::runJSTest): Made this function a gtest predicate-formatter. This allows us
to use a pretty error message when the test fails.

TestWebKitAPI/JavaScriptTest.h: Changed runJSTest to a predicate-formatter, and added nice

(TestWebKitAPI::createSessionStateContainingFormData): Ditto. Note that this function no
longer returns 0 when the JS test fails. That shouldn't have any effect on whether or not
the test passes, though. Returning early seems to have been an unnecessary optimization.

Stop adding class="webkit-indent-blockquote" on blockquotes created by execCommand('Indent') and
execCommand('Outdent'). Also removed the code to add the class attribute in ApplyBlockElementCommand
since no other class inherited from ApplyBlockElementCommand uses this feature.

MediaPlayerPrivateAVFoundationCF::playerItemStatus() should return MediaPlayerAVPlayerItemStatusDoesNotExist if there is no AVPlayerItem
to match the Mac implementation in MediaPlayerPrivateAVFoundationObjC. I also added better logging to notificationCallback().

Reviewed by Jon Honeycutt.

No new tests, uses existing media tests.

platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::MediaPlayerPrivateAVFoundationCF::playerItemStatus): Return MediaPlayerAVPlayerItemStatusDoesNotExist if no AVPlayerItem.
(WebCore::AVFWrapper::notificationCallback): Log the name of the received notification.

WebKit by and large deals with two scale factors: one intrinsic to the device on which the
software is running, and one that is per-Page and can be controlled via API calls. This
patch names the former "deviceScaleFactor" and the latter "pageScaleFactor", and makes the
code use those names. It should introduce no behavior changes.