Remove the --64-bit argument from scripts in favor of them detecting when 64-bit should be preferred.

Reviewed by Timothy Hatcher.

The scripts will automatically target 64-bit if the system and hardware support it. This can be
overridden by passing --32-bit to individual scripts, or using set-webkit-configuration --32-bit
to make the override persistent.

Scripts/build-webkit: Remove architecture-related code.

Scripts/gdb-safari: Remove architecture-related code, and clean up how the environment variables are passed to gdb.

Scripts/run-javascriptcore-tests: Remove architecture-related code.

Scripts/run-safari: Ditto.

Scripts/run-webkit-tests: Ditto.

Scripts/set-webkit-configuration: Handle the --32-bit and --64-bit arguments. The --32-bit argument will set the

architecture preference to the 32-bit architecture of the machine. The --64-bit argument will remove any architecture
override that is in effect so that 64-bit support will be automatically detected.

Scripts/webkitdirs.pm: Add auto-detection of the best architecture for the machine, and the ability to override the

Prevent AllInOneFile.cpp and ProfileGenerator.cpp from rebuilding unnecessarily when
switching between building in Xcode and via build-webkit.

Reviewed by David Kilzer.

build-webkit passes FEATURE_DEFINES to xcodebuild, resulting in it being present in the
Derived Sources build settings. When building in Xcode, this setting isn't present so
Xcode reruns the script build phases. This results in a new version of TracingDtrace.h
being generated, and the files that include it being rebuilt.

JavaScriptCore.xcodeproj/project.pbxproj: Don't regenerate TracingDtrace.h if it is

Fix transparent text rendering on Chromium. FontChromiumWin
was calling beginTransparencyLayer()/endTransparencyLayer(), with
a TransparencyWin inside to do GDI ClearType rendering over an
opaque background. TransparencyWin does its special sauce
in the destructor, but it was being called too late to be used
correctly in the layer. Put the special sauce into a new function,
composite(), and call that explicitly instead.

inspector/InspectorController.cpp:
(WebCore::InspectorController::populateScriptObjects): Changed to use InspectorDatabaseResource::bind.
(WebCore::InspectorController::resetScriptObjects): Changed to use InspectorDatabaseResource::unbind.
(WebCore::InspectorController::didOpenDatabase): Changed to use InspectorDatabaseResource::unbind.

This makes drawRect() ignore the stroke width (like CG does), and
adds a warning comment about that to the appropriate header.

It also eliminates some hacky code in Skia's stroke preparation,
which tried to adjust odd-width strokes to fall on pixel boundaries.
Not only did this not match CG, it wouldn't necessarily work right,
because there could be other transforms (e.g. full-page zoom) that
would affect the stroke before it reached the device pixel level.

Geolocation now requests permission from the Chrome asynchronously.
The Chrome is passed the Geolocation object, and the Chrome sets the permission
on the Geolocation. Geolocation also tracks if the Chrome should clear its cache
of SecurityOrigins with geolocation permission. This is so that the GeolocationService
can inform the Chrome of its request, and the Chrome is also free to implement its
own policy.

<rdar://problem/6630340> REGRESSION (39114-39115): Unity Web Player no longer works if Flip4Mac is also installed

The code assumed if we have a plug-in that supports "application/x-oleobject" we should always prefer the object tag
over of an embed tag. That assumption can cause the Mac platform to load the wrong plug-in, as Flip4Mac claims supports
for x-oleobject.

xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::networkError): Call internalAbort() to fully reset the request.
(WebCore::XMLHttpRequest::didFailRedirectCheck): No need to call internalAbort() here. Note
that since internalAbort() can drop GC protection, it is not safe to use the object after
this call.
(WebCore::XMLHttpRequest::didReceiveData): Check that the request wasn't aborted, and
return early if it was. This can happen during sync requests, as the loader does not know
that it was aborted, and just synthesizes all callbacks.

xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::statusText): Return ResourceResponse status text. It is now up
to each platform to correctly set the status text or set it to "OK" to retain current
behavior.

Prevent CSSStyleSheet::checkLoaded() writing to freed memory when it gets
deleted from under itself. The sheetLoaded() notification can allow scripts
to run via HTMLTokenizer::executeScriptsWaitingForStylesheets(),
which can cause the last ref to the CSSStyleSheet to be released.

​https://bugs.webkit.org/show_bug.cgi?id=24498
Fix the Qt port to use the same algorithm for drawing dashed and dotted
borders as the other ports. This makes the Qt port pixel-for-pixel perfect
compared to border drawing with Apple's canonical mac port and much closer
to konqueror and firefox behavior.

Add a test to check that an invalid second argument of
window.postMessage is ignored. Note that this is probably not the
correct behavior according to the HTML5 spec, so this test will
need to be changed once we support that.

Do not ignore alpha color in optimization. Hard to believe, but there
are websites that fill the entire page with a tiled image consisting of
nothing but a 100% transparent 1x1 image. <cough>orbitz.com</cough>

Also changed a Windows-only assertion about thread name length to an
all-platform log message.

Reviewed by Adam Treat.

wtf/Threading.cpp:
(WTF::createThread): Warn if the thread name is longer than 31
characters, as Visual Studio will truncate names longer than that
length.

wtf/ThreadingWin.cpp:
(WTF::setThreadNameInternal): Renamed from setThreadName and changed
to always operate on the current thread.
(WTF::initializeThreading): Changed to use setThreadNameInternal.
(WTF::createThreadInternal): Removed call to setThreadName. This is
now handled by threadEntryPoint and setThreadNameInternal.

Also make page up and page down keys be handled by the webview key
event code, so that they also work in cases where the GTK+
scrollbars don't handle them directly, like in the bugzill's patch
review page.

and no file or directory names are specified on the command-line
then try to find unmerged ChangeLog files based on 'svn stat' or
'git diff'. Added global $isGit and $isSVN variables so that
isGit() and isSVN() only have to be called once.
(findUnmergedChangeLogs): Added.

Splitted the code from cloneNode into cloneElementWithChildren and cloneElementWithChildren.
Now cloneNode calls one of the 2 previous methods.

Renamed cloneElement to cloneElementWithoutChildren as it was the previous behaviour.

Moved cloneNode to the Element private section so that WebCore callers cannot use it.

Removed Element::cloneNode usage through WebCore.

dom/Element.cpp:
(WebCore::Element::cloneNode): Moved to Element's private section and it
now calls the two next methods.
(WebCore::Element::cloneElementWithChildren): Added.
(WebCore::Element::cloneElementWithoutChildren): Renamed from cloneElement
to avoid ambiguity.

dom/Element.h:

editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): Changed call to cloneElement
to call to cloneElementWithoutChildren.

03/11/09:

<rdar://problem/6673852> Widget "Simple World Clock" does not display with Safari 4

Reviewed by Adele Peterson.

A number of dashboard widgets rely on canvas failing silently when given invalid
colors for gradient stops, but both the spec and firefox throw exceptions here.
So we work around this by creating a dashboard quirk that will only suppress the
exception in dashboard compatibility mode.

editing/TextIterator.h: Added BackwardsCharacterIterator with the
minimal functionality required for this patch.
(WebCore::BackwardsCharacterIterator::atEnd): Added.

editing/visible_units.cpp:
(WebCore::firstNonComplexContextLineBreak): Added this helper function
that returns the index of the first character in the string whose
Unicode line breaking property value is not SA ("Complex Context"), or
the length of the string if there is no such character.
(WebCore::lastNonComplexContextLineBreak): Added this helper function
that returns the index of the last character in the string whose
Unicode line breaking property value is not SA ("Complex Context"), or
-1 if there is no such character.
(WebCore::previousBoundary): Changed the signature of the search
function to include an offset parameter. Renamed the 'exception' local
variable to 'ec' and changed its type to ExceptionCode. Extend the
string forwards until the first character with Unicode line breaking
property value other than SA. This gives the boundary search function
enough context in the forward direction. Changed to use a
BackwardsCharacterIterator for translating the backwards offset into
a position.
(WebCore::nextBoundary): Changed the signature of the search
function to include an offset parameter. Extend the string backwards
until the first character with Unicode line breaking property value
other than SA. This gives the boundary search function enough context in
the backwards direction. Restricted the workaround for <rdar://5192593>
only to the line break case, because it was causing an extra character
to be selected following a word that ended with a combining mark.
(WebCore::startWordBoundary): Added an offset parameter. Check that
going backwards from the given offset, there is a character with Unicode
line breaking property value other than SA, and otherwise return 0 to
request more context.
(WebCore::endWordBoundary): Similar, but in reverse.
(WebCore::previousWordPositionBoundary): Similar.
(WebCore::nextWordPositionBoundary): Similar.
(WebCore::startSentenceBoundary): Updated for the new search function
signature.
(WebCore::endSentenceBoundary): Ditto.
(WebCore::previousSentencePositionBoundary): Ditto.
(WebCore::nextSentencePositionBoundary): Ditto.

LayoutTests:

Reviewed by Darin Adler.

test for <rdar://problem/3919124> Thai text selection in Safari is
incorrect

Make sure that AnimationControllerPrivate::getAnimatedStyleForRenderer() never
returns a null style if it has a valid renderer, which could happen if a
CompositeAnimation existed, but wasn't running any animations or transitions.

When the cancel button in the search field is shown or hidden,
we need to explicitly setStyle() on the cancel button's renderer,
to ensure that repaint happens. Changing the style without telling
the renderer won't work.

Also reset WebSettings to its default state for JavaScript
profiling, Developer Extras and Private Browsing before running
the test (can be after each test but we want to be consistent with
other ports in this regard)

Fix 'make' clean targets. We shouldn't be removing DerivedSources
if it's only clean. Only remove it if it's distclean or
maintainer-clean. Also remove build-related auxillary files on
dist/maintainer clean.

<rdar://problem/6123770> Restrict access to document.cookie when making a cross-site XHR

WebCore:

xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseXML): Removed an incorrect
comment about cookie support. Firefox doesn't expose cookies on responseXML at all, and
there are security concerns with exposing them for cross-origin requests, so it's not clear
if we want to change anything here.

LayoutTests:

http/tests/security/cookies/xmlhttprequest.html: We don't expose cookies for documents
retrieved via XMLHttpRequest. Added a check to make sure that we don't forget about cross-
origin restrictions if we ever decide to change that.

http/tests/xmlhttprequest/resources/get-set-cookie.cgi: While at it, fixed a broken check
for Set-Cookie2.

Fix hit testing of absolutely positioned single line text controls by
ensuring that we set result.innerNode() correctly. If the hit node is
a descendant of the inner text element or if it is the <input> itself,
then we say we hit the innerTextElement.

Rename hitInnerTextBlock() to hitInnerTextElement() to match the
'innerTextElement' terminology used elsewhere.

Assert that if renderer()->hitTest() returns false, no-one set
result.innerNode().

Fix for <rdar://problem/6624769> REGRESSION (Safari 4 PB): No
scroll bar appears for long line of text with NOWRAP set

This is a regression from ​http://trac.webkit.org/changeset/32226
I talked with Dan about the original change, and we decided that
the best fix was to remove his small potential-optimization that
only created a separate line box for whitespace under certain
circumstances. This new code will always create a separate line
box.

Round CFAbsoluteDates to the nearest second when converting to/from the Windows DATE format.

This corrects for inaccuracies introduced by round-tripping between DATE (day based) and CFAbsoluteDate (second based).
The WebKit COM API on Windows uses DATE, while our history storage uses CFAbsoluteTime. This could lead to WebKit
saying there was browsing history for a particular day, and then return no history items when we requested a
list of sites visited that day.

dom/Range.cpp:
(WebCore::Range::compareBoundaryPoints): Split out assertion. It's better not to
use && in assertions since we'd like to know which condition is failing.

editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleToRange): Added a null check before
calling compareBoundaryPoints, since a 0 for the node is ambiguous and so the
function doesn't know which value to return.

Implement the Cairo version of the checkForSolidColor() method. This halfes the
time to draw on 1x1 px background images.
I added two new calls to Color for the pixel manipulation on cairo_surface's.
They are neede to premultiply/unpremultiply the colors of the surface.

Add support for registering noAccess URL schemes:
1- Add FrameLoader::registerURLSchemeAsNoAccess, and have SecurityOrigin check
that list upon construction (similar to how isLocal is implemented).
2- Make InspectorController call grantUniversalAccess on its Document's
SecurityOrigin at the time when windowScriptObjectAvailable is called.

This enables content such as the inspector to be loaded from a custom (non-file)
URL, which is how Chromium loads the inspector. It also allows other URL schemes
to be treated like data: URLs, which Chromium utilizes for its various HTML-based
UI panels.

As suggested in dom/Position.h, this patch gets rid of the
'offset()' accessor and renames posOffset to m_offset. I've used
m_offset instead of offset to follow the style guide lines, since
Position is still a class and not a structure. If the long term
plan is still to make it a structure it would be pretty easy to
just s/m_offset/offset/ globally when that is achieved.

editing/markup.cpp: (WebCore::createMarkup): Added updateLayoutIgnorePendingStylesheets
call to the one of the two overloads of this function that wasn't calling it. This fixes
this crash and other possible crashes inside innerHTML.

This removes TextDecoder class, since its only purpose was to check for BOM, which is
already done in TextResourceDecoder. Callers that use TextEncoding::decode() won't get
BOM checked, but I didn't find any cases where it would significantly change behavior.

loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::TextResourceDecoder): Updated for m_encoding being a member.
(WebCore::TextResourceDecoder::setEncoding): Ditto.
(WebCore::TextResourceDecoder::checkForBOM): Removed a FIXME saying that a BOM could override
even a user-chosen encoding - this is how it already worked due to TextDecoder checking for
BOM again. Made this function return the detected BOM length.
(WebCore::TextResourceDecoder::decode): Skip the BOM if it was found at the beginning of
a text resource.
(WebCore::TextResourceDecoder::flush): Reset m_checkedForBOM, so that re-decoding the same
resource again (as frequently done by CachedResource subclasses) will skip the BOM correctly.

platform/text/TextEncoding.cpp: (WebCore::TextEncoding::decode):
Use TextCodec directly without a TextDecoder wrapper. This means that this method no longer
checks for BOM, which was a counter-intuitive feature.

loader/appcache/ManifestParser.cpp:
(WebCore::parseManifest):
Use TextResourceDecoder, as TextEncoding::decode() no longer checks for BOM.
A side effect of this is that these resources will now be subject to encoding auto-detection.

loader/CachedFont.cpp: (WebCore::CachedFont::ensureSVGFontData):

page/Page.cpp: (WebCore::Page::userStyleSheet):
Be sure to flush TextResourceDecoder, pushing any remaining bytes out, and making the decoder
re-usable (for repeated decoding of the same resource).

Implement importScripts, currently uses a series of synchronous loads
to fetch the scripts, but this is simpler than a synchronous load of
multiple loads in parallel. In future we'll want to switch to parallel
loading, but this will do for now.

r41508 actually exposed a pre-existing bug where we were not invalidating the result
register cache at jump targets. This causes problems when condition loads occur in an

expression -- namely through the ?: and

operators. This patch corrects these issues

by marking the target of all forward jumps as being a jump target, and then clears the
result register cache when ever it starts generating code for a targeted instruction.

I do not believe it is possible to cause this class of failure outside of a single
expression, and expressions only provide forward branches, so this should resolve this
entire class of bug. That said i've included a test case that gets as close as possible
to hitting this bug with a back branch, to hopefully prevent anyone from introducing the
problem in future.

Removed the redundant localToContainerQuad() methods, which can now
shared code with the old mapLocalToAbsolutePoint(), which was
renamed to mapLocalToContainer(). This can now convert a point,
and optionally a FloatQuad, which are carried along in the TransformState.

Optimized TransformState to reduce to simple FloatPoint.move()
if there are no transforms, and to heap-allocate a transform only if
necessary to accumulate transforms (when using preserve-3d).

Tested by 3d point mapping tests, and the inspector highlight (which now shows
the correct quads for 3d-transformed elements).

​https://bugs.webkit.org/show_bug.cgi?id=24463
WebCore::qstring is detaching and copying twice for every single
WebCore::TextRun that is processed and drawn. This elevates this method
to one of the top-ten most expensive methods in all of QtWebKit according
to profiling. This changes the method so that QString only detaches
when absolutely necessary.