Add a timer for style recalc (similar to the one used for scheduling layouts). For now in order
to reduce the risk of regressions, I have left in all the synchronous machinery for updating style
following DOM events and JavaScript timeouts. Eventually these calls will be removed.

Where the timer will really kick in and be useful is for clients that do style changes from
Objective-C DOM bindings or that execute JavaScript to manipulate style from the JavaScriptCore C API.

Windows part 1 of <rdar://problem/5438063> Saving history containing 100,000 entries causes pauses of 2s while browsing

WebCore:

Start compiling HistoryPropertyList on Windows

Reviewed by Darin Adler.

WebCore.vcproj/WebCore.vcproj: Added HistoryPropertyList and its
dependencies to the project. Copy headers from history/cf to
$WebKitOutputDir.

history/cf/HistoryPropertyList.cpp: Added StringExtras.h so that
this file will compile on Windows.

WebKit/win:

Windows part 1 of <rdar://problem/5438063> Saving history containing
100,000 entries causes pauses of 2s while browsing

Use HistoryPropertyListWriter to implement IWebHistory::saveToURL.

Reviewed by Darin Adler.

WebHistory.cpp:
(WebHistoryWriter::WebHistoryWriter): Added.
(WebHistoryWriter::writeHistoryItems): Added. Loop backwards through
the entries for each date, and pass the corresponding
WebCore::HistoryItem to writeHistoryItem.
(WebHistory::saveHistoryGuts): Use WebHistoryWriter to serialize
m_entriesByDate, then write the serialized data to disk using
CFWriteStream.

fix <rdar://problem/6166612> Text boxes' metrics should be based on
the actual fonts used in them, not just the primary font

Covered by many existing layout tests

platform/graphics/Font.cpp:
(WebCore::Font::floatWidth): Added a fallbackFonts parameter. If the
platform supports collecting fallback fonts in its complex font path
and fallbackFonts is not null, all fallback fonts used for the text run
will be added to it.

platform/graphics/Font.h:
(WebCore::Font::width): Ditto.

platform/graphics/FontFastPath.cpp:
(WebCore::Font::glyphDataForCharacter): Removed an unnecessary namespace
qualifier.
(WebCore::Font::floatWidthForSimpleText): Added a fallbackFonts
parameter, which is passed down to WidthIterator.

platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::WidthIterator): Added a fallbackFonts parameter
and used it to initialize the m_fallbackFonts member.
(WebCore::WidthIterator::advance): Track the fonts being used and add
any fallback fonts to the m_fallbackFonts set. Make sure to only add
non-small-caps fonts.

platform/graphics/WidthIterator.h:

platform/graphics/chromium/FontChromiumWin.cpp:
(WebCore::Font::canReturnFallbackFontsForComplexText): Added an
implementation that returns false, meaning this platform's
implementation of floatWidthForComplexText() does not populate the
fallbackFonts set.
(WebCore::Font::floatWidthForComplexText): Updated for the new
prototype.

platform/graphics/chromium/FontLinux.cpp: Ditto.

platform/graphics/gtk/FontGtk.cpp: Ditto.

platform/graphics/mac/CoreTextController.cpp:
(WebCore::CoreTextController::CoreTextController): Added a fallbackFonts
parameter and used it to initialize the m_fallbackFonts member.
(WebCore::CoreTextController::collectCoreTextRunsForCharacters): Add
fallback fonts to m_fallbackFonts.

platform/graphics/mac/CoreTextController.h:

platform/graphics/mac/FontMac.mm:
(WebCore::Font::canReturnFallbackFontsForComplexText): Added an
implementation that returns true, indicating that the Mac
implementations of floatWidthForComplexText() populate the fallbackFonts
set.

platform/graphics/mac/FontMacATSUI.mm:
(WebCore::ATSULayoutParameters::ATSULayoutParameters): Added a
fallbackFonts parameter and used it to initialize the m_fallbackFonts
member.
(WebCore::ATSULayoutParameters::initialize): Add fallback fonts to
m_fallbackFonts.
(WebCore::Font::floatWidthForComplexText): Added a fallbackFonts
parameter, which is passed down to ATSULayoutParameters.

platform/graphics/mac/FontMacCoreText.cpp:
(WebCore::Font::floatWidthForComplexText): Added a fallbackFonts
parameter, which is passed down to CoreTextController.

platform/graphics/win/FontWin.cpp:
(WebCore::Font::canReturnFallbackFontsForComplexText): Added an
implementation that returns true, indicating that the
UniscribeController-based implementations of floatWidthForComplexText()
populate the fallbackFonts set.
(WebCore::Font::floatWidthForComplexText): Added a fallbackFonts
parameter, which is passed down to UniscribeController.

platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::UniscribeController): Added a
fallbackfonts parameter and used it to initialize m_fallbackFonts.
(WebCore::UniscribeController::advance): Add fallback fonts to
m_fallbackFonts.

platform/graphics/win/UniscribeController.h:

platform/graphics/wx/FontWx.cpp:
(WebCore::Font::canReturnFallbackFontsForComplexText): Added an
implementation that returns false, meaning this platform's
implementation of floatWidthForComplexText() does not populate the
fallbackFonts set.
(WebCore::Font::floatWidthForComplexText): Updated for the new
prototype.

rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeLogicalBoxHeights): For an InlineTextBox
with multiple fonts, compute a common baseline and line height by
considering all fonts' ascents and descents (and line spacing, if
applicable).

rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::setFallbackFonts): Added. Temporarily stores
the set of fallback fonts in a vector.
(WebCore::InlineTextBox::takeFallbackFonts): Added. Returns the fallback
fonts previously stored and removes them from storage.

rendering/InlineTextBox.h:

rendering/RenderText.cpp:
(WebCore::RenderText::RenderText): Initialized the
m_knownNotToUseFallbackFonts to false.
(WebCore::RenderText::styleDidChange): Reset
m_knownNotToUseFallbackFonts to false if the style difference is such that
affects layout.
(WebCore::RenderText::widthFromCache): Added a fallbackFonts parameter,
which is passed down to Font::width().
(WebCore::RenderText::trimmedPrefWidths): Updated for the change to
widthFromCache().
(WebCore::RenderText::calcPrefWidths): Made this call a private version
of calcPrefWidths() that takes a fallbackFonts parameter and set the
m_knownNotToUseFallbackFonts to true if the set comes back empty.
The private version passes the fallbackFonts set to widthFromCache().
(WebCore::RenderText::setText): Reset m_knownNotToUseFallbackFonts to
false.
(WebCore::RenderText::createFallbackFontMetricsBox): Added.
(WebCore::RenderText::width): Added a fallbackFonts parameter, which is
passed down to calcPrefWidths(), widthFromCache() and Font::width().
Set m_knownNotToUseFallbackFonts to true when appropriate.

rendering/RenderText.h:

rendering/bidi.cpp:
(WebCore::RenderBlock::constructLine): Added an assertion and a continue
statement to remove one level of indentation.
(WebCore::RenderBlock::computeHorizontalPositionsForLine): Temporarily
store the set of fallback fonts in the InlineTextBox.
(WebCore::RenderBlock::computeVerticalPositionsForLine): Added an
assertion.

​https://bugs.webkit.org/show_bug.cgi?id=25030
Refactor MessagePort code to enable Chrome to use a MessagePortProxy object
instead of a real MessagePort for the entangledPort, since it could
theoretically live in a separate process.

The goal of this refactoring is to remove all assumptions that the object
representing the entangled port is actually of type MessagePort. All
operations that were previously directly modifying private MessagePort member
variables in the entangled port (i.e. entangle(), postMessage()) have been changed
to invoke functions in the MessagePortProxy interface instead which will allow
the Chrome bindings to proxy these calls to another process.

No new layout tests, as this is just a refactoring with no bug fixes
or new functionality.

In the realm case, decide if it is a simple or complex realm name. A realm name
is considered complex if it has any whitespace or newline characters. Present
alternative text and layout for the complex case, where the realm name isn't inline
with the rest of the sheet's text.

Panels/English.lproj/WebAuthenticationPanel.nib/designable.nib:

Panels/English.lproj/WebAuthenticationPanel.nib/keyedobjects.nib:

Updated the nib with a new 'separateRealmLabel' outlet.
Updated the File's Owner to correctly be WebAuthenticationPanel.
Fixed springs on the sheet's icon to keep it from moving during a resize.

Launch DumpRenderTree and the image diff tool in a way that will work from perl threads.
This is a workaround due to a perl limitation. When perl does open* calls on a thread, it ignores
the environment of the current thread and simply uses the environment of the main thread instead.

Have one base a11y type, and generate derived types that implement
only the necessary interfaces at runtime, based on the specific
object we are wrapping. This allows to save a lot of code while
covering all possible cases.

Make <select>s in application chrome documents match the Vista system dialog look

Reviewed by Dave Hyatt.

rendering/RenderThemeWin.cpp:
(WebCore::documentIsInApplicationChromeMode): Added this simple helper
function.
(WebCore::RenderThemeWin::getThemeData): In application chrome mode,
the drop down button never uses any look but the "normal" look.
(WebCore::RenderThemeWin::paintMenuList): In application chrome mode,
use the "readonly" style to match system dialogs.

RenderButton's m_timer is not stopped when its Document enters the
page cache. When the WebView was torn down, the timer would fire after
the Frame's Page had been destroyed, leading to a crash. This patch
just makes the timer do nothing when it fires. Making the timer not
fire when in the page cache is covered by bug 25110.

Reviewed by Dave Hyatt.

No test possible.

rendering/RenderButton.cpp:
(WebCore::RenderButton::timerFired): Do nothing when we're in the page
cache.

04/08/09:

The result of excess arguments to function.apply is irrelevant
so we don't need to provide a result register. We were providing
temporary result register but not ref'ing it resulting in an
assertion failure.

Configurations/JavaScriptCore.xcconfig: Added
ENABLE_SVG_DOM_OBJC_BINDINGS variable and use it in
FEATURE_DEFINES.

WebCore:

Configurations/WebCore.xcconfig: Added
ENABLE_SVG_DOM_OBJC_BINDINGS variable and use it in
FEATURE_DEFINES and EXCLUDED_SOURCE_FILE_NAMES. When SVG DOM
Objective-C bindings are disabled, two generated header files no
longer exist and none of the generated DOMSVG*.mm files should
be compiled.

DerivedSources.make: All of the WebCore.SVG*.exp files contain
SVG DOM Objective-C bindings classes, so exclude them unless
ENABLE_SVG_DOM_OBJC_BINDINGS is set.

bindings/objc/DOM.mm: Switched from using ENABLE(SVG) to using
ENABLE(SVG_DOM_OBJC_BINDINGS).
(WebCore::createElementClassMap):
(+[DOMNode _wrapNode:WebCore::]):

fix <rdar://problem/6771547> Appending to a RenderText causes all its
lines to be dirtied

Test: fast/repaint/text-append-dirty-lines.html

rendering/RenderText.cpp:
(WebCore::RenderText::setTextWithOffset): If no text boxes intersected
with or came after the new text, dirty the last root box, since the new
text may begin there. Having at least one dirty line prevents the
incorrect dirtying of all lines later during layoutInlineChildren().

LayoutTests:

Reviewed by Dave Hyatt.

test for <rdar://problem/6771547> Appending to a RenderText causes all its
lines to be dirtied

platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::loadResourceSynchronously): Mimic the
ResourceHandleMac code by propagating the CFError's error code for
kCFErrorDomainCFNetwork errors to the ResourceResponse.

Make sure that cloneNode works with SVG attributes that require synchronization. This fixes
issues with <use> element shadow tree cloning where the clones can end up not obtaining the
correct attribute values.

A subsequent patch of mine will expose this problem and cause it to be covered by existing
layout tests, so no test is required at this time for this problem.

Added support for returning plugins which support the wildcard mime type (*).
This is on the same lines as Firefox, which uses a wildcard plugin (npnul32.dll) for
plugin installation. The changes to support wildcard mime type matching are in
PluginDatabase.cpp which is used by Webkit's plugin implementation, and
PluginData.cpp/.h which is used by Chromium.

OSX media player should set readyState to HAVE_ENOUGH_DATA when the movie's load state
reaches QTMovieLoadStatePlaythroughOK, not when the entire file has been downloaded,
so autoplay can begin when it should.

platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::cacheControlContainsNoCache): Fixed a copy/paste mistake,
m_cacheControlContainsMustRevalidate was returned instead of m_cacheControlContainsNoCache.

API/tests/testapi.c:
(timeZoneIsPST): Added a function that checks whether the time zone is PST, using the same
method as functions in DateMath.cpp do for formatting the result.
(main): Skip date string format test if the time zone is not PST.

platform/graphics/win/QTMovieWin.cpp:
(QTMovieWin::getNaturalSize): Call GetMovieNaturalBoundsRect, which
returns the movie's natural bounds (duh), rather than GetMovieBox,
which returns the movie's current displayed size/position.

The expected behavior for persistent storage when private browsing mode is undefined by the spec.
For now we're going with a "read-only when in private browsing" policy until we can get feedback
and/or get the behavior specified in the spec.

Note that I purposefully made the change to restrict SessionStorage to read-only, also, with the
understanding that the spec allows for SessionStorage to persist across relaunches, even though
our implementation currently doesn't do this.

dom/DOMCoreException.idl: Add some new ExceptionCodes defined in HTML5, one of which is needed
for LocalStorage changes (QUOTA_EXCEEDED_ERR)

dom/ExceptionCode.cpp:

dom/ExceptionCode.h:

storage/StorageArea.cpp:
(WebCore::StorageArea::internalSetItem): If private browsing is enabled, throw the QUOTA_EXCEEDED_ERR
exception as the spec allows.
(WebCore::StorageArea::internalRemoveItem): If private browsing is enabled, silently fail to remove
the item.
(WebCore::StorageArea::internalClear): If private browsing is enabled, silently fail to clear the area.

Standalone media documents can not always handle everything
using a <video> element. In these cases switch to an <embed>
element that uses the QuickTime plugin, in the hope that it
will have more luck. Typical media types that trigger this
are streamed media and QTVR.

Fix ScrollView's algorithm that determines whether or not to show scrollbars. There was a bug
with the method mainly because RenderView will size itself to the viewport's size, making it
impossible to really know the document's "true" size.

In order to solve this problem ScrollView now has a minimumContentsSize method. This method
returns the document size excluding the RenderView from the calculation. This width/height
is now cached on RenderView in m_docWidth/m_docHeight member variables.

Tests in http/tests/xmlhttprequest/web-apps were taking results from
platform/mac instead of LayoutTests, so added the values from LayoutTests
into platform/win, and removed a few tests from the skip list that are fixed
by the fix to platform/network/cf/ResourceResponseCFNet.cpp

Clean up repaint logic when RenderLayers become and stop being composited.

rendering/RenderLayer.h:

rendering/RenderLayer.cpp:
(WebCore::RenderLayer::rendererContentChanged):
(WebCore::RenderLayer::repaintIncludingNonCompositingDescendants):
New compositing-only method that repaints a layer and all its non-composited descendants.
Takes a repaintContainer for performance; all the repaints necessarily share the same
repaintContainer.

rendering/RenderLayerCompositor.h:

rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerCompositingState):
Rather than use calculateCompositedBounds() to compute the repaint rect (which gave
the wrong answer when the composited layer tree was in flux), use the new
repaintOnCompositingChange() method.

(WebCore::RenderLayerCompositor::repaintOnCompositingChange):
Call repaintIncludingNonCompositingDescendants(), and if necessary make sure
that the view/layer drawing synchronization happens.

(WebCore::RenderLayerCompositor::computeCompositingRequirements):
Do a repaintOnCompositingChange() when a layer is going to be composited. This is
a good place because we haven't started to change the compositing tree.

(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
After we've finished updating all the descendant layers, we can do a repaint for
layers that ceased compositing.

rendering/RenderThemeWin.cpp: Added new constants.
(WebCore::RenderThemeWin::getThemeData): On Vista, use the
CP_DROPDOWNBUTTONRIGHT part for drop down buttons.
(WebCore::RenderThemeWin::paintMenuList): On Vista, use the CP_BORDER
part to draw the border of <select>s.
(WebCore::RenderThemeWin::paintMenuListButton): On Vista, outset the
drop down button to make its border coincide with the <select>'s
border.

Added some double-checking to event handler marking. Now, when the
wrapper that's responsible for marking an event handler's JavaScript
function gets collected, it clears the event handler's JavaScript function
so we won't dereference it after it's collected.

In theory, we would never dereference a JavaScript event handler after
its node's wrapper was collected anyway, but it's nice to be safe.

runtime/UString.cpp:
(JSC::initializeStaticBaseString):
(JSC::initializeUString):
(JSC::UString::BaseString::isShared):
Encapsulate the meaning behind the refcount == 1 checks because
this needs to do slightly more when sharing is added.
(JSC::concatenate):
(JSC::UString::append):
(JSC::UString::operator=):

runtime/UString.h:
Make m_baseString part of a union to get rid of casts, but make it protected because
it is tricky to use it correctly since it is only valid when the Rep is not a BaseString.
The void* will be filled in when sharing is added.

Add constructors due to the making members protected and it make ensuring proper
initialization work better (like in SmallStringsStorage).
(JSC::UString::Rep::create):
(JSC::UString::Rep::Rep):
(JSC::UString::Rep::):
(JSC::UString::BaseString::BaseString):
(JSC::UString::Rep::setBaseString):
(JSC::UString::Rep::baseString):

fix <rdar://problem/6764359> Thai word selection misbehaves for the
last sentence in the document

Test: editing/selection/thai-word-at-document-end.html

editing/visible_units.cpp:

Added a BoundarySearchContextAvailability enum used to indicate
whether the caller to a boundary search function may be able to provide
additional text in the search direction and call again.

Added a named type for the boundary search function signature. Changed
the signature to take a context availability parameter and a boolean
out parameter indicating whether more context is needed to perform
the search.

(WebCore::previousBoundary): If the beginning of the range was reached

but the last search wanted more context, perform the search again, this
time indicating that there is no earlier text.

(WebCore::nextBoundary): Similarly, in the other direction.
(WebCore::startWordBoundary): Check whether more context may be available

Clean up the accelerated compositing code that determines the format of
the GraphicsLayer hierarchy, being more explicit about which parts have
to happen before and after descendant layers have been updated. Also remove
some unhelpful caching of state.

dom/Document.cpp:
(WebCore::Document::recalcStyle):
Only call updateCompositingLayers() if we know we're not going to be
doing a layout soon.

platform/graphics/mac/GraphicsLayerCA.mm:
(WebCore::GraphicsLayerCA::setDrawsContent):
Toggling drawsContent from false to true should do a setNeedsDisplay().

rendering/RenderLayer.cpp:
(WebCore::RenderLayer::styleChanged):
updateLayerCompositingState() no longer updates the layer geometry, so
do that here if we're not going to rebuild layers anyway.
Also, updateLayerCompositingState() no longer does a setContentsNeedDisplay,
so do that if the style change indicates that a repaint is required.

rendering/RenderLayerBacking.h:

rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::RenderLayerBacking::updateAfterLayout):
The 'drawing optimizations' logic has been rolled into updateGraphicsLayerConfiguration()
and updateGraphicsLayerGeometry().

(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration):
Group that code that decides what GraphicsLayers are needed into this method,
which deals with clipping layers and 'direct compositing': images that can be
rendered via the compositor.

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
Call setDrawsContent() if updateGraphicsLayerConfiguration() didn't already
figure it out for image layers.

(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
Remove the m_simpleCompositingLayerStatusDirty cache indicator, since we just
computed it every time anyway.

rendering/RenderLayerCompositor.h:

rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerCompositingState):
updateGraphicsLayers() was renamed to updateGraphicsLayerConfiguration(),
which calls clippedByAncestor() etc. itself rather than having everything passed in.
Repaints are taken care of by styleChanged() and setDrawsContent().

(WebCore::RenderLayerCompositor::calculateCompositedBounds):
!layer->isComposited() && layer->transform() is a synonym for paintsWithTransform().

g++ 4.4.0 seems to be more strict about aliasing rules, so it
produces incorrect code if dtoa.cpp is compiled with
-fstrict-aliasing (it also emits a ton of warnings, so fair enough
I guess). The problem was that we were only casting variables to
union types in order to do type punning, but GCC and the C
standard require that we actually use a union to store the value.

The problem was that a protected event listener's scope chain would end
up with a reference to the Node protecting it, causing a cycle. The
solution is to stop protecting event listeners and rely on marking instead.

This patch converts most Node event listeners to use marking instead of
GC protection.

bindings/js/JSDOMBinding.cpp:
(WebCore::isObservableThroughDOM):
(WebCore::markDOMNodesForDocument): Refactored the test for whether a Node
needs marking, and added a case for marking the node in order to mark its
event listeners.

Pull the call to updateGraphicsLayerGeometry() out of updateGraphicsLayers(),
because we need to call it at the end of rebuildCompositingLayerTree() once
we've determined which descendant layers are composited, otherwise
calculateCompositedBounds() can give the wrong answer.

Now that updateLayerCompositingState() doesn't end up calling updateGraphicsLayerGeometry(),
call that explicitly from styleChanged(), if we know a layer update is not pending,
and similarly from updateAfterLayout().