[GTK] Add stdlib include file to fix ImageDiff build with libc++
https://bugs.webkit.org/show_bug.cgi?id=128454

Patch by Rajaram Gaunker <zimbabao@gmail.com> on 2014-02-08
Reviewed by Darin Adler.

* ImageDiff/gtk/ImageDiff.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163711 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
https://bugs.webkit.org/show_bug.cgi?id=128233

Reviewed by Anders Carlsson.

Source/WebCore:

* accessibility/AccessibilityNodeObject.cpp: Removed unneeded TextIterator.h include.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::hasMisspelling): Updated to use StringView for checkSpelling.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(AXAttributeStringSetSpelling): Changed to take a StringView.
(AXAttributedStringAppendText): Ditto.
(-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Pass StringView.

* editing/Editor.cpp:
(WebCore::Editor::misspelledWordAtCaretOrRange): Pass StringView.
(WebCore::Editor::misspelledSelectionString): Ditto.
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Ditto.

* editing/TextCheckingHelper.cpp:
(WebCore::findGrammaticalErrors): Renamed this function. Changed to use StringView.
(WebCore::findMisspellings): Use StringView.
(WebCore::TextCheckingHelper::findFirstMisspelling): Ditto. Also separated out assertions
that were asserting multiple things with &&.
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Ditto.
(WebCore::TextCheckingHelper::findFirstGrammarDetail): Ditto.
(WebCore::TextCheckingHelper::findFirstBadGrammar): Ditto.
(WebCore::TextCheckingHelper::isUngrammatical): Ditto.
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): Ditto.
(WebCore::checkTextOfParagraph): Ditto.

* editing/TextCheckingHelper.h: Made TextCheckingParagraph::text public. Deleted
TextCheckingParagraph::textDeprecatedCharacters. Added comments about additional
TextCheckingParagraph refinements. Changed checkTextOfParagraph to take a client
reference instead of pointer and StringView instead of characters pointer with length.

* editing/TextIterator.cpp:
(WebCore::TextIterator::appendTextToStringBuilder): Use data members directly,
rather than using functions, since we already checked m_textCharacters for null.
(WebCore::CharacterIterator::string): Use text() instead of characters().
(WebCore::WordAwareIterator::WordAwareIterator): Removed initialization of
m_previousText now that it's a StringView rather than a pointer.
(WebCore::WordAwareIterator::advance): Use TextIterator::text instead of
TextIterator::characters. Also added a FIXME about a fundamental problem
with the implementation of this class!
(WebCore::WordAwareIterator::length): Updated for m_previousText change.
(WebCore::WordAwareIterator::text): Replaced WordAwareIterator::characters with this.
(WebCore::SearchBuffer::append): Changed to take a StringView.
(WebCore::SearchBuffer::prependContext): Ditto.
(WebCore::SearchBuffer::isWordStartMatch): Use StringView.
(WebCore::SearchBuffer::search): Ditto.
(WebCore::findPlainText): Ditto.

* editing/TextIterator.h: Added TextIterator::text that returns a StringView, and
renamed TextIterator::characters to TextIterator::deprecatedTextIteratorCharacters
(easy to search for in source code). Added SimplifiedBackwardsTextIterator::text
and removed SimplifiedBackwardsTextIterator::characters. Added CharacterIterator::text,
and removed CharacterIterator::characters. Added WordAwareIterator::text and removed
WorkdAwareIterator::characters. Changed WordAwareIterator data members to use StringView.

* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::appendTrailingWhitespace): Use TextIterator::text instead
of TextIterator::characters.

* editing/VisibleUnits.cpp:
(WebCore::previousBoundary): Updated to use StringView.
(WebCore::nextBoundary): Ditto.
(WebCore::startWordBoundary): Ditto.
(WebCore::startOfWord): Ditto.
(WebCore::endWordBoundary): Ditto.
(WebCore::endOfWord): Fixed formatting.
(WebCore::previousWordPositionBoundary): Updated to use StringView.
(WebCore::previousWordPosition): Fixed formatting and got rid of local variable.
(WebCore::nextWordPositionBoundary): Updated to use StringView.
(WebCore::nextWordPosition): Fixed formatting and got rid of local variable.
(WebCore::inSameLine): Fixed formatting.
(WebCore::isStartOfLine): Ditto.
(WebCore::isEndOfLine): Ditto.
(WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to take a reference.
(WebCore::previousLinePosition): Fixed formatting chand changed to pass a reference.
(WebCore::nextLinePosition): Ditto.
(WebCore::startSentenceBoundary): Updated to use StringView and got rid of a local.
(WebCore::startOfSentence): Fixed formatting.
(WebCore::endSentenceBoundary): Updated to use StringView and got rid of a local.
(WebCore::endOfSentence): Fixed formatting.
(WebCore::previousSentencePositionBoundary): Updated to use StringView and got rid of
a local.
(WebCore::previousSentencePosition): Ditto.
(WebCore::nextSentencePositionBoundary): Ditto.
(WebCore::nextSentencePosition): Fixed formatting.
(WebCore::endOfParagraph): Ditto.
(WebCore::inSameParagraph): Ditto.
(WebCore::isStartOfParagraph): Ditto.
(WebCore::isEndOfParagraph): Ditto.
(WebCore::inSameBlock): Ditto.
(WebCore::isStartOfBlock): Ditto.
(WebCore::isEndOfBlock): Ditto.
(WebCore::startOfDocument): Ditto.
(WebCore::endOfDocument): Ditto.
(WebCore::inSameDocument): Ditto.
(WebCore::isStartOfDocument): Ditto.
(WebCore::isEndOfDocument): Ditto.
(WebCore::isEndOfEditableOrNonEditableContent): Ditto.

* loader/EmptyClients.h: Use StringView.

* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]): Use StringView.

* platform/text/TextBoundaries.cpp:
(WebCore::endOfFirstWordBoundaryContext): Use StringView and unsigned.
(WebCore::startOfLastWordBoundaryContext): Ditto.

* platform/text/TextBoundaries.h: Change interfaces to use StringView,
and in some cases, unsigned instead of int. All call sites were better off
with unsigned.

* platform/text/TextCheckerClient.h: Use StringView.

* platform/text/mac/TextBoundaries.mm: Changed conditionals to say
USE(APPKIT) instead of PLATFORM(IOS), since that's the real issue.
(WebCore::isSkipCharacter): Tweaked formatting.
(WebCore::isWhitespaceCharacter): Ditto.
(WebCore::isWordDelimitingCharacter): Ditto, also removed local variable.
(WebCore::isSymbolCharacter): Ditto.
(WebCore::tokenizerForString): Ditto.
(WebCore::findSimpleWordBoundary): Use StringView. Also changed to mostly
use unsigned instead of int.
(WebCore::findComplexWordBoundary): Use StringView. Also restructured to
be much more readable, with early returns and such.
(WebCore::findWordBoundary): Use StringView and unsigned.
(WebCore::findEndWordBoundary): Removed redudant copy of the findWordBoundary
function and changed this to just call findWordBoundary. The reason this
function exists is to optimize this case for some non-Mac, non-iOS platforms.
We can always do that for Mac and/or iOS later if we like.
(WebCore::findNextWordFromIndex): Use StringView. Also use wordBreakIterator
instead of using UBreakIterator directly so we get a cached iterator instead
of creating and destroying a new one each time this function is called.

* bindings/objc/DOMUIKitExtensions.mm: Removed unneeded includes.
* dom/Element.cpp: Ditto.
* dom/PositionIterator.cpp: Ditto.
* editing/ApplyBlockElementCommand.cpp: Ditto.
* editing/IndentOutdentCommand.cpp: Ditto.
* editing/InsertListCommand.cpp: Ditto.
* editing/markup.cpp: Ditto.
* html/HTMLElement.cpp: Ditto.
* html/HTMLTextAreaElement.cpp: Ditto.
* page/Frame.cpp: Ditto.
* rendering/RenderTextControl.cpp: Ditto.

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::checkSpellingOfString): Use StringView.
(WebCore::EditorClientEfl::checkGrammarOfString): Ditto.
* WebCoreSupport/EditorClientEfl.h: Ditto.

Source/WebKit/gtk:

* WebCoreSupport/TextCheckerClientGtk.cpp:
(WebKit::TextCheckerClientGtk::checkSpellingOfString): Use StringView.
(WebKit::TextCheckerClientGtk::checkGrammarOfString): Ditto.
* WebCoreSupport/TextCheckerClientGtk.h: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.h: Made most data members private. Moved inlines
for iOS out of the class definition. Fixed formatting. Added missing virtual keyword.
Changed interfaces to use StringView.

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::checkTextOfParagraph): Use the new StringView::createNSStringWithoutCopying
function instead of a similar function that was local in this file.
(WebEditorClient::ignoreWordInSpellDocument): Tweaked formatting.
(WebEditorClient::checkSpellingOfString): Changed to take a StringView.
(WebEditorClient::checkGrammarOfString): Ditto.

* WebView/WebTextIterator.mm:
(-[WebTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.
(-[WebTextIterator currentText]): Convert a the text to an NSString with TextIterator::text
instead of with TextIterator::characters/length.

Source/WebKit/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::checkSpellingOfString): Use StringView.
(WebEditorClient::checkGrammarOfString): Ditto.
* WebCoreSupport/WebEditorClient.h: Ditto.

Source/WebKit/wince:

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::checkSpellingOfString): Use StringView.
(WebKit::EditorClientWinCE::checkGrammarOfString): Ditto.
* WebCoreSupport/EditorClientWinCE.h: Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
(-[WKDOMTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::checkSpellingOfString): Use StringView.
(WebKit::WebEditorClient::checkGrammarOfString): Ditto.
* WebProcess/WebCoreSupport/WebEditorClient.h: Ditto.

Source/WTF:

* WTF.xcodeproj/project.pbxproj: Added new source files.

* wtf/text/StringView.h: Added operator[], createCFStringWithoutCopying, and
createNSStringWithoutCopying.
* wtf/text/cf/StringViewCF.cpp:
(WTF::StringView::createCFStringWithoutCopying): Added.
* wtf/text/mac/StringViewObjC.mm:
(WTF::StringView::createNSString): Added.
(WTF::StringView::createNSStringWithoutCopying): Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Convert current MHTML tests into reftests
https://bugs.webkit.org/show_bug.cgi?id=116443

Reviewed by Andreas Kling.

Convert the current set of MHTML tests into reference tests. Reference files are copied from the *_original files
where available (with the *_original files removed) or from the source markup and code that's stored in the archive.
Both the archives and the reference files are adjusted to now dump pixel output instead of text.

* mhtml/check_domain-expected.html: Added.
* mhtml/check_domain-expected.txt: Removed.
* mhtml/check_domain.mht:
* mhtml/frame_4.html_original: Removed.
* mhtml/multi_frames.html_original: Removed.
* mhtml/multi_frames_binary-expected.html: Added.
* mhtml/multi_frames_binary-expected.txt: Removed.
* mhtml/multi_frames_binary.mht:
* mhtml/multi_frames_ie-expected.html: Added.
* mhtml/multi_frames_ie-expected.txt: Removed.
* mhtml/multi_frames_ie.mht:
* mhtml/multi_frames_unmht-expected.html: Added.
* mhtml/multi_frames_unmht-expected.txt: Removed.
* mhtml/multi_frames_unmht.mht:
* mhtml/page_with_css_and_js_ie-expected.html: Copied from LayoutTests/mhtml/page_with_css_and_js.html_original.
* mhtml/page_with_css_and_js_ie-expected.txt: Removed.
* mhtml/page_with_css_and_js_ie.mht:
* mhtml/page_with_css_and_js_unmht-expected.html: Renamed from LayoutTests/mhtml/page_with_css_and_js.html_original.
* mhtml/page_with_css_and_js_unmht-expected.txt: Removed.
* mhtml/page_with_css_and_js_unmht.mht:
* mhtml/page_with_image.html_original: Removed.
* mhtml/page_with_image_ie-expected.html: Added.
* mhtml/page_with_image_ie-expected.txt: Removed.
* mhtml/page_with_image_ie.mht:
* mhtml/page_with_image_unmht-expected.html: Added.
* mhtml/page_with_image_unmht-expected.txt: Removed.
* mhtml/page_with_image_unmht.mht:
* mhtml/resources/frame_0.html: Renamed from LayoutTests/mhtml/frame_0.html_original.
* mhtml/resources/frame_1.html: Renamed from LayoutTests/mhtml/frame_1.html_original.
* mhtml/resources/frame_2.html: Renamed from LayoutTests/mhtml/frame_2.html_original.
* mhtml/resources/frame_4.html: Added.
* mhtml/resources/hide_image.css: Added.
(#secondDiv):
* mhtml/resources/remove_image_script.js: Added.
(onLoad):
* mhtml/resources/style.css: Copied from LayoutTests/mhtml/shared_buffer_bug.mht.
(h1):
* mhtml/shared_buffer_bug-expected.html: Added.
* mhtml/shared_buffer_bug-expected.txt: Removed.
* mhtml/shared_buffer_bug.mht:
* mhtml/simple_page_ie-expected.html: Copied from LayoutTests/mhtml/simple_page.html_original.
* mhtml/simple_page_ie-expected.txt: Removed.
* mhtml/simple_page_ie.mht:
* mhtml/simple_page_unmht-expected.html: Renamed from LayoutTests/mhtml/simple_page.html_original.
* mhtml/simple_page_unmht-expected.txt: Removed.
* mhtml/simple_page_unmht.mht:


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