2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Introduce a new StringWithDirection object that carries a String along
with the TextDirection associated with the String. Use this object for
document titles used within WebCore, because in HTML the direction of
a title can be set with the 'dir' attribute.
Put FIXMEs at the WebKit level to expose the new direction information
to clients.
No behavioral change intended, so no new tests. A follow-up will expose
the title direction and hopefully can be accompanied by tests that
verify it is correct.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::updateTitle):
(WebCore::Document::setTitle):
(WebCore::Document::removeTitle):
* dom/Document.h:
(WebCore::Document::title):
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::HTMLTitleElement):
(WebCore::HTMLTitleElement::childrenChanged):
(WebCore::HTMLTitleElement::text):
(WebCore::HTMLTitleElement::textWithDirection):
* html/HTMLTitleElement.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::setTitle):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::title):
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::dispatchDidReceiveTitle):
(WebCore::EmptyFrameLoaderClient::setTitle):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::setTitle):
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::updateForBackForwardNavigation):
(WebCore::HistoryController::updateForReload):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateForClientRedirect):
(WebCore::HistoryController::updateForCommit):
(WebCore::HistoryController::setCurrentItemTitle):
(WebCore::HistoryController::initializeItem):
* loader/HistoryController.h:
* platform/text/StringWithDirection.h: Added.
(WebCore::StringWithDirection::StringWithDirection):
(WebCore::StringWithDirection::operator==):
(WebCore::StringWithDirection::operator!=):
* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::insertedIntoDocument):
(WebCore::SVGTitleElement::childrenChanged):
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::dispatchDidReceiveTitle):
(WebKit::FrameLoaderClientImpl::setTitle):
* src/FrameLoaderClientImpl.h:
* src/WebDataSourceImpl.cpp:
(WebKit::WebDataSourceImpl::pageTitle):
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::dispatchDidReceiveTitle):
(WebCore::FrameLoaderClientEfl::setTitle):
* WebCoreSupport/FrameLoaderClientEfl.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidReceiveTitle):
(WebKit::FrameLoaderClient::setTitle):
* WebCoreSupport/FrameLoaderClientGtk.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/FrameLoaderClientHaiku.cpp:
(WebCore::FrameLoaderClientHaiku::dispatchDidReceiveTitle):
* WebCoreSupport/FrameLoaderClientHaiku.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidReceiveTitle):
(WebFrameLoaderClient::setTitle):
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDidReceiveTitle):
(WebCore::FrameLoaderClientQt::setTitle):
* WebCoreSupport/FrameLoaderClientQt.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidReceiveTitle):
* WebCoreSupport/WebFrameLoaderClient.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebCoreSupport/FrameLoaderClientWinCE.cpp:
(WebKit::FrameLoaderClientWinCE::dispatchDidReceiveTitle):
(WebKit::FrameLoaderClientWinCE::setTitle):
* WebCoreSupport/FrameLoaderClientWinCE.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebKitSupport/FrameLoaderClientWx.cpp:
(WebCore::FrameLoaderClientWx::dispatchDidReceiveTitle):
(WebCore::FrameLoaderClientWx::setTitle):
* WebKitSupport/FrameLoaderClientWx.h:
2011-03-31 Evan Martin <evan@chromium.org>
Reviewed by Eric Seidel.
<title> should support dir attribute
https://bugs.webkit.org/show_bug.cgi?id=50961
Update to new FrameLoaderClient interface.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
(WebKit::WebFrameLoaderClient::setTitle):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index 121045b..1437adc 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -649,7 +649,7 @@
m_stopRecordingResponses = true;
}
-void DocumentLoader::setTitle(const String& title)
+void DocumentLoader::setTitle(const StringWithDirection& title)
{
if (title.isEmpty())
return;
diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h
index 1f88272..c6f0bc5 100644
--- a/Source/WebCore/loader/DocumentLoader.h
+++ b/Source/WebCore/loader/DocumentLoader.h
@@ -36,6 +36,7 @@
#include "ResourceError.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
+#include "StringWithDirection.h"
#include "SubstituteData.h"
#include "Timer.h"
#include <wtf/HashSet.h>
@@ -121,7 +122,7 @@
bool wasOnloadHandled() { return m_wasOnloadHandled; }
bool isLoadingInAPISense() const;
void setPrimaryLoadComplete(bool);
- void setTitle(const String&);
+ void setTitle(const StringWithDirection&);
void setIconURL(const String&);
const String& overrideEncoding() const { return m_overrideEncoding; }
@@ -168,7 +169,7 @@
const ResourceRequest& lastCheckedRequest() { return m_lastCheckedRequest; }
void stopRecordingResponses();
- const String& title() const { return m_pageTitle; }
+ const StringWithDirection& title() const { return m_pageTitle; }
const String& iconURL() const { return m_pageIconURL; }
KURL urlForHistory() const;
@@ -298,7 +299,7 @@
bool m_isClientRedirect;
bool m_wasOnloadHandled;
- String m_pageTitle;
+ StringWithDirection m_pageTitle;
String m_pageIconURL;
String m_overrideEncoding;
diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h
index 59fd897..6acf992 100644
--- a/Source/WebCore/loader/EmptyClients.h
+++ b/Source/WebCore/loader/EmptyClients.h
@@ -266,7 +266,7 @@
virtual void dispatchWillClose() { }
virtual void dispatchDidReceiveIcon() { }
virtual void dispatchDidStartProvisionalLoad() { }
- virtual void dispatchDidReceiveTitle(const String&) { }
+ virtual void dispatchDidReceiveTitle(const StringWithDirection&) { }
virtual void dispatchDidChangeIcons() { }
virtual void dispatchDidCommitLoad() { }
virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { }
@@ -334,7 +334,7 @@
virtual void prepareForDataSourceReplacement() { }
virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return DocumentLoader::create(request, substituteData); }
- virtual void setTitle(const String&, const KURL&) { }
+ virtual void setTitle(const StringWithDirection&, const KURL&) { }
virtual String userAgent(const KURL&) { return ""; }
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 347a41e..f1020e1 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -610,7 +610,7 @@
dispatchDidClearWindowObjectsInAllWorlds();
if (m_documentLoader) {
- String ptitle = m_documentLoader->title();
+ StringWithDirection ptitle = m_documentLoader->title();
// If we have a title let the WebView know about it.
if (!ptitle.isNull())
m_client->dispatchDidReceiveTitle(ptitle);
@@ -1924,9 +1924,9 @@
dispatchDidCommitLoad();
// If we have a title let the WebView know about it.
- String title = m_documentLoader->title();
- if (!title.isNull())
- m_client->dispatchDidReceiveTitle(title);
+ StringWithDirection title = m_documentLoader->title();
+ if (!title.isNull())
+ m_client->dispatchDidReceiveTitle(title);
checkCompleted();
} else {
@@ -3375,7 +3375,7 @@
}
#endif
-void FrameLoader::setTitle(const String& title)
+void FrameLoader::setTitle(const StringWithDirection& title)
{
documentLoader()->setTitle(title);
}
diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h
index 1fb9e3c..9062f21 100644
--- a/Source/WebCore/loader/FrameLoader.h
+++ b/Source/WebCore/loader/FrameLoader.h
@@ -78,6 +78,7 @@
class SecurityOrigin;
class SerializedScriptValue;
class SharedBuffer;
+class StringWithDirection;
class SubstituteData;
class TextResourceDecoder;
@@ -282,7 +283,7 @@
void cancelAndClear();
- void setTitle(const String&);
+ void setTitle(const StringWithDirection&);
void setIconURL(const String&);
void commitProvisionalLoad();
diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h
index 7d64912..d5d49ec 100644
--- a/Source/WebCore/loader/FrameLoaderClient.h
+++ b/Source/WebCore/loader/FrameLoaderClient.h
@@ -84,6 +84,7 @@
class ResourceResponse;
class SecurityOrigin;
class SharedBuffer;
+ class StringWithDirection;
class SubstituteData;
class Widget;
@@ -139,7 +140,7 @@
virtual void dispatchWillClose() = 0;
virtual void dispatchDidReceiveIcon() = 0;
virtual void dispatchDidStartProvisionalLoad() = 0;
- virtual void dispatchDidReceiveTitle(const String& title) = 0;
+ virtual void dispatchDidReceiveTitle(const StringWithDirection&) = 0;
virtual void dispatchDidChangeIcons() = 0;
virtual void dispatchDidCommitLoad() = 0;
virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0;
@@ -227,7 +228,7 @@
virtual void prepareForDataSourceReplacement() = 0;
virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) = 0;
- virtual void setTitle(const String& title, const KURL&) = 0;
+ virtual void setTitle(const StringWithDirection&, const KURL&) = 0;
virtual String userAgent(const KURL&) = 0;
diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp
index b8bece9..c1c5414 100644
--- a/Source/WebCore/loader/HistoryController.cpp
+++ b/Source/WebCore/loader/HistoryController.cpp
@@ -265,7 +265,7 @@
{
#if !LOG_DISABLED
if (m_frame->loader()->documentLoader())
- LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().utf8().data());
+ LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
#endif
// Must grab the current scroll position before disturbing it
@@ -281,7 +281,7 @@
{
#if !LOG_DISABLED
if (m_frame->loader()->documentLoader())
- LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().utf8().data());
+ LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
#endif
if (m_currentItem) {
@@ -343,7 +343,7 @@
{
#if !LOG_DISABLED
if (m_frame->loader()->documentLoader())
- LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().utf8().data());
+ LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
#endif
Settings* settings = m_frame->settings();
@@ -385,7 +385,7 @@
{
#if !LOG_DISABLED
if (m_frame->loader()->documentLoader())
- LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().utf8().data());
+ LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
#endif
// Clear out form data so we don't try to restore it into the incoming page. Must happen after
@@ -410,7 +410,7 @@
FrameLoader* frameLoader = m_frame->loader();
#if !LOG_DISABLED
if (frameLoader->documentLoader())
- LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().utf8().data());
+ LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().string().utf8().data());
#endif
FrameLoadType type = frameLoader->loadType();
if (isBackForwardLoadType(type)
@@ -526,10 +526,11 @@
m_currentItem = item;
}
-void HistoryController::setCurrentItemTitle(const String& title)
+void HistoryController::setCurrentItemTitle(const StringWithDirection& title)
{
if (m_currentItem)
- m_currentItem->setTitle(title);
+ // FIXME: make use of title.direction() as well.
+ m_currentItem->setTitle(title.string());
}
bool HistoryController::currentItemShouldBeReplaced() const
@@ -576,12 +577,13 @@
Frame* parentFrame = m_frame->tree()->parent();
String parent = parentFrame ? parentFrame->tree()->uniqueName() : "";
- String title = documentLoader->title();
+ StringWithDirection title = documentLoader->title();
item->setURL(url);
item->setTarget(m_frame->tree()->uniqueName());
item->setParent(parent);
- item->setTitle(title);
+ // FIXME: should store title directionality in history as well.
+ item->setTitle(title.string());
item->setOriginalURLString(originalURL.string());
if (!unreachableURL.isEmpty() || documentLoader->response().httpStatusCode() >= 400)
diff --git a/Source/WebCore/loader/HistoryController.h b/Source/WebCore/loader/HistoryController.h
index 59f11a2..15e12c0 100644
--- a/Source/WebCore/loader/HistoryController.h
+++ b/Source/WebCore/loader/HistoryController.h
@@ -40,6 +40,7 @@
class Frame;
class HistoryItem;
class SerializedScriptValue;
+class StringWithDirection;
class HistoryController {
WTF_MAKE_NONCOPYABLE(HistoryController);
@@ -71,7 +72,7 @@
HistoryItem* currentItem() const { return m_currentItem.get(); }
void setCurrentItem(HistoryItem*);
- void setCurrentItemTitle(const String&);
+ void setCurrentItemTitle(const StringWithDirection&);
bool currentItemShouldBeReplaced() const;
HistoryItem* previousItem() const { return m_previousItem.get(); }