constructTreeFromCompactHTMLToken should call clearExternalCharacters
https://bugs.webkit.org/show_bug.cgi?id=111248

Reviewed by Adam Barth.

I don't know how to write a test for this.  It's possible characters()
is never accessed from HTMLStackItem::token(), but it's better to be
safe than sorry here.

* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::constructTreeFromCompactHTMLToken):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove two unnecessary mallocs from the main-thread-parser code path
https://bugs.webkit.org/show_bug.cgi?id=111249

Reviewed by Adam Barth.

I noticed these while fixing up our Vector -> String conversions
but never went back to fix the FIXME.

AtomicString(Vector<UChar, capacity>) is smart enough to avoid mallocing
if the represented string is already in the AtomicString table.  It
also handles 8bit vs. 16bit and empty() just like nameString() does.

I also removed a 3rd caller to nameString() in the XSSAuditor which
was causing an unnecessary malloc in both the main and background
thread parser paths.

* html/parser/AtomicHTMLToken.h:
(WebCore::AtomicHTMLToken::AtomicHTMLToken):
* html/parser/HTMLToken.h:
* html/parser/XSSAuditor.cpp:
(WebCore):
(WebCore::threadSafeMatch):
(WebCore::hasName):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
BUILD FIX (r143637): Predeclare JSContext as an Objective-C class
<http://webkit.org/b/106059>

Fixes the following build failure:

    In file included from Source/WebKit/ios/DefaultDelegates/WebDefaultFrameLoadDelegate.m:11:
    In file included from Source/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h:29:
    Source/WebKit/mac/WebView/WebFrameLoadDelegate.h:215:64: error: expected a type
    - (void)webView:(WebView *)webView didCreateJavaScriptContext:(JSContext *)context forFrame:(WebFrame *)frame;
                                                                   ^
    1 error generated.

* WebView/WebFrameLoadDelegate.h: Add @class JSContext
declaration.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
BUILD FIX (r143637): Export ScriptController::javaScriptContext() on iOS
<http://webkit.org/b/106059>

Fixes the following build failure:

    Undefined symbols for architecture armv7:
      "__ZN7WebCore16ScriptController17javaScriptContextEv", referenced from:
          -[WebFrame javaScriptContext] in WebFrame.o
          __ZN20WebFrameLoaderClient35dispatchDidClearWindowObjectInWorldEPN7WebCore15DOMWrapperWorldE in WebFrameLoaderClient.o
    ld: symbol(s) not found for architecture armv7

* WebCore.exp.in: Export ScriptController::javaScriptContext()
even more unconditionally.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move computedStyleIncludingVisitedInfo from TestRunner to Internals
https://bugs.webkit.org/show_bug.cgi?id=109772

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-03-02
Reviewed by Andreas Kling.

Source/WebCore: 

The function computedStyleIncludingVisitedInfo() is purely internal to WebCore,
it is better defined on Internals than on TestRunner.

* testing/Internals.cpp:
(WebCore::Internals::computedStyleIncludingVisitedInfo):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/blackberry: 

* WebKitSupport/DumpRenderTreeSupport.cpp:
* WebKitSupport/DumpRenderTreeSupport.h:
(DumpRenderTreeSupport):

Source/WebKit/efl: 

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Source/WebKit/gtk: 

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Source/WebKit/mac: 

* WebView/WebView.mm:
* WebView/WebViewPrivate.h:

Source/WebKit/qt: 

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
* WebCoreSupport/DumpRenderTreeSupportQt.h:

Source/WebKit2: 

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
* WebProcess/WebPage/WebFrame.cpp:
* WebProcess/WebPage/WebFrame.h:
(WebFrame):

Tools: 

* DumpRenderTree/TestRunner.cpp:
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
(TestRunner):
* DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
* DumpRenderTree/efl/TestRunnerEfl.cpp:
* DumpRenderTree/gtk/TestRunnerGtk.cpp:
* DumpRenderTree/mac/TestRunnerMac.mm:
* DumpRenderTree/qt/TestRunnerQt.cpp:
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunner):
* DumpRenderTree/win/TestRunnerWin.cpp:
* DumpRenderTree/wx/TestRunnerWx.cpp:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):

LayoutTests: 

Update the tests.

* fast/history/multiple-classes-visited.html:
* fast/history/nested-visited-test.html:
* fast/history/self-is-visited.html:
* fast/history/sibling-visited-test.html:
* fast/loader/stateobjects/state-url-sets-links-visited.html:
* platform/win/TestExpectations: unskip the tests.
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Export a missing symbol after r144547.

Unreviewed.

* WebKit.vcproj/WebKitExports.def.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
XSSAuditor has a subtle race condition when used with the threaded HTML parser
https://bugs.webkit.org/show_bug.cgi?id=111253

Reviewed by Eric Seidel.

We were refing and derefing a StringImpl for a main-thread
AtomicString. Using QualifiedNames on the background thread is very
fragile and we should figure out a more robust solution.

* html/parser/XSSAuditor.cpp:
(WebCore::findAttributeWithName):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit2 is missing the setShowsURLsInToolTips preference
https://bugs.webkit.org/show_bug.cgi?id=111259
<rdar://problem/12991891>

Reviewed by Maciej Stachowiak.

* Shared/WebPreferencesStore.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShowsURLsInToolTipsEnabled):
(WKPreferencesGetShowsURLsInToolTipsEnabled):
* UIProcess/API/C/WKPreferencesPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Pipe it through.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
StringHasher functions require alignment that call sites do not all guarantee
https://bugs.webkit.org/show_bug.cgi?id=110171

Reviewed by Benjamin Poulain.

Source/WebCore:

* platform/graphics/WidthCache.h:
(WebCore::WidthCache::SmallStringKey::SmallStringKey): Use the newly added
addCharactersAssumingAligned to make sure we don't slow this call site down.
It's safe since this code always adds characters two at a time.

Source/WTF:

The StringHasher class is optimized for clients who pass it two characters at
a time. However, the function named addCharacters did not make this clear to
clients, and one calculateStringHashAndLengthFromUTF8MaskingTop8Bits got it wrong.
Fix by making addCharacters work regardless of hasher alignment and adding a new
function, addCharactersAssumingAligned, for use when we want a faster path and can
guarantee we are adding characters two at a time.

* wtf/StringHasher.h:
(WTF::StringHasher::addCharactersAssumingAligned): Renamed the addCharacters function
addCharactersAssumingAligned, since it only works if the hasher is currently aligned,
meaning it contains an even number of characters. The function already asserts
that this is true, but the calculateStringHashAndLengthFromUTF8MaskingTop8Bits
function was using it in cases where the assertion could fire. Also updated to
call addCharactersInternal by its new name. Also added some new overloads that take
data pointers and lengths so callers can always use addCharactersAssumingAligned
instead of addCharacters if they know the hasher is aligned.
(WTF::StringHasher::addCharacter): Updated to call the public
addCharactersAssumingAligned function since that's simpler and a bit cleaner.
(WTF::StringHasher::addCharacters): Added functions with this name that handle
the case where the hasher is not aligned. These will be called by existing call sites
that were formerly using the function named addCharactersAssumingAligned above.
Also add an overload that works with the default converter automatically.
(WTF::StringHasher::computeHashAndMaskTop8Bits): Changed to call
addCharactersAssumingAligned to eliminate copied and pasted code. The hasher is empty,
so definitely aligned.
(WTF::StringHasher::computeHash): Ditto.
(WTF::StringHasher::addCharactersInternal): Renamed from addCharactersToHash, since
the former name did not make clear how this differs from the public functions.
The real difference is that this is like addCharactersAssumingAligned, but without
the assertion, so addCharactersAssumingAligned is called instead, even within the
class's implementation.

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/GNUmakefile.am:
* TestWebKitAPI/TestWebKitAPI.gypi:
* TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj:
* TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/WTF.pro:
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
Added the StringHasher.cpp file.

* TestWebKitAPI/Tests/WTF/StringHasher.cpp: Added. Contains a bunch of tests
for the functions in the StringHasher class.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Cut down the number of source files that depend on Clipboard.h
https://bugs.webkit.org/show_bug.cgi?id=110030

Reviewed by Ryosuke Niwa.

Source/WebCore:

I am doing some work on Clipboard and it's better to recompile 50 files
each time we touch the header instead of 700. Also cut down on includes
of DragState.h.

* WebCore.exp.in: Updated for new MouseEvent::create function.

* dom/ClipboardEvent.cpp: Added include of Clipboard.h since we use it
here and the world no longer includes it everywhere.

* dom/ClipboardEvent.h: Forward declared Clipboard instead of including
Clipboard.h. Also made some overrides private because they can be.

* dom/DataTransferItem.h: Removed unneeded include of Clipboard.h.

* dom/MouseEvent.cpp: Added include of Clipboard.h since we use it
here and the world no longer includes it everywhere.
(WebCore::MouseEvent::create): Made the create function non-inline
since we can't compile it without including Clipboard.h and we don't
want to include Clipboard.h in the header. This is not so commonly
used or so hot that this needs to be inlined.

* dom/MouseEvent.h: Forward declared Clipboard instead of including
Clipboard.h. Made MouseEvent::create a non-inline function and also
used overloading instead of default arguments, since we can't compile
a default argument of type PassRefPtr<Clipboard> without including
Clipboard.h.

* dom/WheelEvent.cpp: Added include of Clipboard.h since we use it
here and the world no longer includes it everywhere.

* dom/WheelEvent.h: Forward declare PlatformWheelEvent since it is used
in this header. Previously we'd get it indirectly from including a header
that included Clipboard.h.

* editing/Editor.cpp: Added include of Clipboard.h since we use it here
and the world no longer includes it everywhere.

* inspector/InspectorDebuggerAgent.cpp: Added include of CachedResource.h.
We used to get this indirectly through Clipboard.h.

* inspector/InspectorFrontendHost.cpp: Added includes of ResourceError.h
and ResourceResponse.h. We used to get these indirectly through Clipboard.h.
Also removed unneeded include of <wtf/RefPtr.h>.

* inspector/NetworkResourcesData.cpp: Added include of CachedResource.h.
We used to get this indirectly through Clipboard.h.

* loader/PingLoader.cpp: Added include of ResourceResponse.h.
We used to get this indirectly through Clipboard.h.

* page/DragController.cpp: Added include of DragState.h.
We used to get this indirectly through EventHandler.h

* page/EventHandler.h: Forward declared DragState and Element instead of
including DragState.h. Also added an include of LayoutPoint.h, which we
used to get indirectly through DragState.h.

Source/WebKit/chromium:

* src/SharedWorkerRepository.cpp: Add include of ResourceResponse.h
here. We used to get this indirectly through Clipboard.h.

Source/WebKit/mac:

* WebView/WebPDFView.mm: Add include of Clipboard.h since we use it
here and the world no longer includes it everywhere.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix build.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Another try at fixing the build.

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