Given that there are lots of places in webkit-patch's code that
assume unix-style filenames (forward slashes), webkit-patch fails
with weird file-not-found errors when run under a native windows
Python. It would be nice if we just trapped this and errored out
at the beginning, rather than producing unpredictable errors.

platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::clip):
Catching the empty path case from being sent directly to
CGContextClip - which would ignore it. Instead, using
CGContextClip with a CGRectZero to achieve the desired
behavior of reducing the clipping region to nothing.

When viewing the source of a document, we want to colorize different
parts of the input depending on how they were tokenized. In this
patch, we expose the internal segmentation of a token by recording the
start and end offsets for each attribute name and each attribute value.

if the DB thread is terminating. Also, when a task is destroyed,
ASSERT that it was completed, or that it had no synchronizer.
(WebCore::Database::openAndVerifyVersion):
(WebCore::Database::markAsDeletedAndClose):
(WebCore::Database::tableNames):

Bug 43817 - Remove UString::Rep
UString::Rep has for a long time been replaced by UStringImpl (Rep
remaining as a typedef). UStringImpl has since been removed too
(unified with StringImpl). Remove Rep, rename rep() to impl() and
m_rep to m_impl. Also add impl() method to Identifier, and rename
its UString member from _ustring to m_string.

This is the first step towards adding Blob URL support. The blob has
an internal URL (used by FileReader) and public URLs (used by Blob.url).
The URL and its associated data are managed by BlobRegistry interface.

This patch does not remove the usage of BlobItem. It will be removed
when all the blob data support is hooked up and the new tests will be
added then.

The easiest way to keep track of how many characters we've consumed
would be to increment a counter every time we advance, but that's too
slow. Instead, we keep track lazily and update our summary durning the
slow case of advance (which is sufficiently rare).

There's some subtly to how this works w.r.t. "unconsuming" characters
by pushing them back on the front of the segmented string. This isn't
really a "right answer" here because the notion of unconsuming input
isn't present in the API. This patch makes some assumptions about how
clients of this class use its API. In a future patch, we might want to
rename some of the method names to make this more explicit.

There was a case where a continuation was added as a child, but if you asked
that child who is your parent, it would return the wrong answer.

The specific scenario was when a sibling of an element who was the start of a
continuation was present. Retrieving the parent object had then follow the sibling
chain and then follow the originating continuation chain.

Removed toString() functions in all SVGPathSeg* objects as well as toPath() in SVGPathSegList.
These hacks were used to create a SVG path data string or a platform path from a SVGPathSegList.
Use the new SVGPathParser instead.

Provide a DeviceOrientationClient to Page by means of a
DeviceOrientationClientProxy that proxies calls to
a WebDeviceOrientationClient, an interface that can be implemented
in the WebKit or Chromium layer. An implementation to be used for
layout tests, wrapping DeviceOrientationClientMock, is provided.

Added SVGPathSegListSource to parse normalized or unaltered SVGPathSegLists and transform
them to either a SVG path string, or a SVGPathByteStream. This will be needed to synchronize
all SVGPathSegLists and the SVG path string of the 'd' attribute.
Refactored SVGPathSource code, to read concrete path segments instead of type/flag/coordinates
from the data sources. This is a further abstraction and seperates the reading of content from
the parsing and interpreting.

When resizesToContents is ON scene's rect is set to the boundary of
the mainFrame. However, navigating to other web page should keep resizing
scene's rect according to the new document loaded. Patch addresses this issue.

This patch makes it possible for an assembler to convert jumps into a different
(presumably more efficient) form at link time. Currently implemented in the
ARMv7 JIT as that already had logic to delay linking of jumps until the end of
compilation already. The ARMv7 JIT chooses between either a 4 byte short jump
or a full 32-bit offset (and rewrites ITTT instructions as appropriate), so does
not yet produce the most compact form possible. The general design of the linker
should make it relatively simple to introduce new branch types with little effort,
as the linker has no knowledge of the exact form of any of the branches.

assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::beginUninterruptedSequence):
(JSC::AbstractMacroAssembler::endUninterruptedSequence):
We have to track uninterrupted sequences in any assembler that compacts
branches as that's not something we're allowed to do in such sequences.
AbstractMacroAssembler has a nop version of these functions as it makes the
code elsewhere nicer.

There's a lot of code that assumes that SegmentedString takes ownership
of its substrings. For example, when the HTML parser pauses and
resumes asynchronously, it could explode if SegmentedString didn't own
its substrings.

Prior to this patch, there was a constructor that let
SegmentedSubstring use an external string buffer. It turns out it was
only used in a handful of places, but I'd rather pay the memcpy of
these small strings than risk having them used after free.

Removed fontColorChangesComputedStyle, fontSizeChangesComputedStyle, and fontFaceChangesComputedStyle
because StyleChange's applyFontColor, applyFontFace, and applyFontSize all return false
if there was no difference between the new font color, font size, font face and that of the computed style.

Also added a work-around for the bug 28282 in getPropertiesNotInComputedStyle with a test so that
the above change will not add a redundant font or span element.

Added a test for applying execCommand('foreColor') by color name. Because of the bug 28282, we have to manually
process color property in getPropertiesNotInComputedStyle to avoid adding a redundant font or span element.

The bug was caused when RemoveCSSPropertyCommand is called with CSSMutableStyleDeclaration of some styled element,
and the style attribute of the element is removed subsequently. When the attribute removal is undone, new instance of
CSSMutableStyleDeclaration is created and RemoveCSSPropertyCommand's m_style became detached from the element.

Modified RemoveCSSPropertyCommand to store the styled element directly instead of its CSSMutableStyleDeclaration.

DocumentParser() now sets the right tokenizer state before handling
fragments. Since default code path uses the HTML5 tokenizer with the
legacy tree builder, this fixes 2 tokenizer-state tests for the html5lib.
This fixes 2 more tree-builder tests when the html5 treebuilder is enabled too.

dom/DocumentFragment.cpp:
(WebCore::DocumentFragment::parseHTML):

HTML5 implementation of fragment parsing requires the context element (parent)
pointer. The legacy implementation handles all parsing branches which require
the context element outside of the parser itself, which likely produces "wrong"
results. We'll remove those branches when we turn on the HMTL5 fragment parser.

(WebCore::DocumentFragment::parseXML):

Rename "parent" to "contextElement" to match the HTML path (and the HTML5 spec).

The HTML5 parsing algorithm fragment case uses a dummy document to handle all the parsing
and then moves all the children from the dummy document over into a DocumentFragment
when the parse is done. We could avoid this adopt step by making the TreeBuilder a bit
more complicated, but I'm not sure that's necessary (yet).

When compositing an accelerated canvas that is using both hardware and software drawing,
we need a callback before compositing the layer to make sure that we upload any software
drawn results to the texture. This will go away as soon as implement all draw calls
in hardware.

To test, run any canvas demo that runs in mixed mode and verifies that the software results
always show up.

When compositing an accelerated canvas that is using both hardware and software drawing,
we need a callback before compositing the layer to make sure that we upload any software
drawn results to the texture. This will go away as soon as implement all draw calls
in hardware.

To test, run any canvas demo that runs in mixed mode and verifies that the software results
always show up.

Skip the slow software rendering path of GraphicsContext3D if accelerated
compositing is active. This fixes an issue with WebGL and the compositor
in which the software rendering of WebGL would cause the current GL context
to change while the compositor was processing layers. Tested by running
several WebGL samples both with the compositor enabled and disabled.​https://bugs.webkit.org/show_bug.cgi?id=43644

[Chromium] Notify the WebFrameClient when the frame is detached from
the view. This is used to clear the cached frame in the FormManager.
Eventually this will be removed once handling forms is moved into
WebCore.​https://bugs.webkit.org/show_bug.cgi?id=43648

nextBoundary() and previousBoundary() assumed that editable
boundaries are on block-level elements, But it can appear on
inline-level elements. So we start boundary look-up from the given
node, instead of the containingBlock of the given node.
Also, added TextIteratorEndsAtEditingBoundary to
BackwardsCharacterIterator, otherwise, the VisiblePosition
returned by BackwardsCharacterIterator might cross an editing
boundary.

Sets the shouldLazyAttach flag to true for appendChild() calls inside the HTML tree
builder's adoption agency flag. This is a speedup assuming that nodes subjected
to the adoption agency are likely to be frequently reparented, and thus it is better
to delay creating the render tree until later (when hopefully the DOM is finalized).

On my mac pro this speeds up fast/parser/residual-style-hang.html by 2.6X.

Introduces SVGPathStringBuilder. SVGPathParser clients, like normalized and unaltered
SVGPathSegLists or SVGPathByteStreams, can be parsed and transformed to a string.
StringBuilder can create a string of individual strings, seperated by spaces now.
Share more code in SVGPathParserFactory and use a common general concept to manage SVG path
data parsing.

Doesn't affect any tests.

Android.mk:

GNUmakefile.am:

WebCore.gypi:

WebCore.pro:

WebCore.vcproj/WebCore.vcproj:

WebCore.xcodeproj/project.pbxproj:

platform/text/StringBuilder.cpp:
(WebCore::StringBuilder::toString): Added possibility to use a space between individual strings.

ASSERTs aren't in release builds, so we can't use them to validate user
input! We've seen a bunch of examples of this in SVG code. It might
be worth auditing all the code to remove this misguided pattern.

Adds tests that simulates flow from a page that's in the page cache to
one that's not, and then back to the page cached page (where the
DocumentLoader is reused, but we should have a new DocumentLoadTiming
struct).

Normally, loadPtr will optimize when the register is eax. Since
the slightly smaller instruction changes the offsets, it messes up
our ability to repatch the code. We added this new instruction
that garuntees a constant size.

As described in StructureStubInfo.h, we needed to add additional
fields to both StructureStubInfo and
PolymorphicAccessStructureList so that we can determine the
structure of the JITed code at patch time.

(WebCore::tryHyphenating): The character at lastSpace is not necessarily a whitespace character
before the current word. It can also be part of the word, such as when the word is the first
one on the line. Include the charcater at lastSpace in the string passed to lastHyphenLocation().

Introduce SVGPathByteStream as a fast and efficient way to organize the synchronization
of Path, SVG path data string and SVGPathSegList in normalized and unaltered modes.
Extended SVGPathParserFactory to accept SVGPathByteStreams as input source and to create
a SVGPathByteStream from a SVG path data string.

Generalize SVGPathParser, by allowing different parsing sources than just strings.
For now only a SVGPathStringSource is available, parsing from bytestreams follows soon.
Each client that wants to parse strings, like Path or SVGPathSegList objects, only
needs to use the new central SVGPathParserFactory, which glues consumer and sources together.
Moved the SVGPathSegType enum from SVGPathSeg class in WebCore namespace, for
easier access throughout the SVG code.

After some investigation, the antialiasing diffs were
definitely verified to be due to the colorspace change
made for ​https://bugs.webkit.org/show_bug.cgi?id=42228
and I'm reasonably confident that these rebaselined
outputs are good.

(WKPreferencesSetFontSmoothingLevel):
Get the font smoothing level from the WKFontSmoothingLevel, and call
WebPreferences::setFontSmoothingLevel().
(WKPreferencesGetFontSmoothingLevel):
Get the font smoothing level from WebPreferences, and translate it to a
WKFontSmoothingLevel.

UIProcess/API/C/WKPreferencesPrivate.h: Added.

Declare the font smoothing levels, and declare functions to get and set
the level.

UIProcess/WebPreferences.cpp:

(WebKit::WebPreferences::setFontSmoothingLevel):
Set fontSmoothingLevel and call update().
(WebKit::WebPreferences::fontSmoothingLevel):
Return the level.

(WebKit::WebPage::platformPreferencesDidChange):
On CG platforms, call wkSetFontSmoothingLevel(). This matches the code
in old WebKit's WebPreferences. Set the font rendering mode to either
normal (CG) or alternative (GDI) based on the font smoothing level. This
matches what was done in old WebKit's WebView.

win/WebKit2.vcproj:

Add FontSmoothingLevel.h and WKPreferencesPrivate.{h,cpp} to project.

win/WebKit2Generated.make:

Copy WKPreferencesPrivate.h.

WebKitTools:

WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::resetPreferencesToConsistentValues):
Set the font smoothing level to
kWKFontSmoothingLevelNoSubpixelAntiAliasing to match DRT.

If a video element has a poster frame, display it until the playback is requested or the movie's
time is changed.

Test: compositing/video/video-poster.html

html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_displayMode.
(WebCore::HTMLMediaElement::prepareForLoad): Set m_displayMode to Unknown.
(WebCore::HTMLMediaElement::loadResource): Call updateDisplayState to let it set configure
the poster, if necessary.
(WebCore::HTMLMediaElement::noneSupported): updatePosterImage -> updateDisplayState.
(WebCore::HTMLMediaElement::setNetworkState): Ditto.
(WebCore::HTMLMediaElement::setReadyState): Ditto.
(WebCore::HTMLMediaElement::finishSeek): Set display mode to Video so a video frame will be
displayed if a poster is currently visible.
(WebCore::HTMLMediaElement::mediaPlayerRepaint): updatePosterImage -> updateDisplayState.
(WebCore::HTMLMediaElement::updatePlayState): Set display mode to Video.

html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::HTMLVideoElement): Remove m_shouldDisplayPosterImage.
(WebCore::HTMLVideoElement::attach): Call shouldDisplayPosterImage instead of checking
m_shouldDisplayPosterImage directly.
(WebCore::HTMLVideoElement::detach): Ditto.
(WebCore::HTMLVideoElement::parseMappedAttribute): Set m_displayMode to Unknown before calling
updateDisplayState so shouldDisplayPosterImage() will return the correct result. Remove the
PLUGIN_PROXY_FOR_VIDEO code, it is now in updateDisplayState.
(WebCore::HTMLVideoElement::setDisplayMode): Renamed from updatePosterImage and rework logic
so we tell the media engine it is OK to display video frames when there is no poster, or
once the media engine has something to display and the movie has started or seeked.
(WebCore::HTMLVideoElement::updateDisplayState): New, manage display mode based on poster
attribute.

platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivate::MediaPlayerPrivate): Initialize m_isAllowedToRender.
(WebCore::MediaPlayerPrivate::setUpVideoRendering):
(WebCore::MediaPlayerPrivate::isReadyForVideoSetup): Renamed from isReadyForRendering.
(WebCore::MediaPlayerPrivate::prepareForRendering): New, set m_isAllowedToRender and
inform the client that render tree should be updated so we correctly switch from showing
the poster, which often doens't use a layer, to showing video frames, which do.
(WebCore::MediaPlayerPrivate::updateStates): Don't call setUpVideoRendering until
isReadyForVideoSetup() returns true.
(WebCore::MediaPlayerPrivate::supportsAcceleratedRendering): isReadyForRendering -> isReadyForVideoSetup

If a video element has a poster frame, display it until the playback is requested or the movie's
time is changed. Test this by ensuring that an element with a poster doesn't have layers while
and element with one does.

Allows for 2d canvas rendering contexts to use a GraphicsContext3D for
accelerated rendering. The rendering context holds the GraphicsContext3D
alive and exposes it to the compositor. The 3d context itself is passed
down through the GraphicsContext to use for actual rendering:​https://bug-43362-attachments.webkit.org/attachment.cgi?id=63557

This approach will let us simultaneously prototype accelerated techniques
for canvas 2d and revise the design of canvas elements without destabilizing
all ports.

This copies the existing implementation exactly. In the future
this will use PendingScript which handles ref counting without
the need for those manual ref()/deref()s. This is also currently
a trivial class, but a little more logic will be added to it to
support <script async>.

This converts all OpenGL calls in GLES2(Canvas|Texture) to calls on the corresponding GraphicsContext3D
API, due to feedback on ​https://bugs.webkit.org/show_bug.cgi?id=43362. Nearly all the changes are
applying the regex s/gl([A-Z])/m_context->%1</ and removing unnecessary makeCurrent() calls.
Other changes hilighted below.

This treats all GraphicsContext3D-backed layers the same instead of special casing WebGL.
The cross-platform change is to rename GraphicsLayer::setContentsToWebGL() to
GraphicsLayer::setContentsToCanvas() and to rename all implementations.

This patch also renames the chromium class used for accelerating these layers.

Change WebChromeClient::webView() to be const because ChromeClient::didReceiveViewportArguments
is const method now, and calling webView() inside port-specific didReceiveViewportArguments
implementation fails compiling if webView() is not const.

CodeGeneratorGObject.pm doesn't know yet how to auto-generate
callbacks, so we should not auto-generate functions that take
callbacks as parameters. This shouldn't break anything, because
all these functions were marked as Custom? until now, and this
code generator skipped those functions anyway.

platform/text/TextCodecICU.cpp: (WebCore::TextCodecICU::registerExtendedEncodingNames):
Don't register ISO8859-16, because older versions of ICU don't support ISO-8859-16, causing
crashes when we try to register an alias. Also, we don't need it, because Firefox doesn't
support this particular alias (it supports ISO8859-1 to ISO8859-15, but only supports the
main name for ISO-8859-16).

Stop storing refcounted CSSValue/CSSValueList objects in SVGRenderStyle, replacing them with SVGLength types.
Allows us to directly specify default values for stroke-dashoffset/width in the SVGRenderStyle, fixing a problem
with stroke-width animations when resetting to the original stored baseVal, exposed in svg/W3C-1.1/animate-elem-40-t.svg
Originally discovered by Fady Samuel.

After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.

PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
to WebKit/qt/WebCoreSupport as well.

All classes that previously inherited from QtAbstractWebPopup now inherit from
QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
instance of class QWebSelectMethod instead of QtAbstractWebPopup.

After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.

PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
to WebKit/qt/WebCoreSupport as well.

All classes that previously inherited from QtAbstractWebPopup now inherit from
QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
instance of class QWebSelectMethod instead of QtAbstractWebPopup.