Diff
Modified: trunk/Source/WebKit2/ChangeLog (159655 => 159656)
--- trunk/Source/WebKit2/ChangeLog 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/ChangeLog 2013-11-22 01:13:02 UTC (rev 159656)
@@ -1,3 +1,22 @@
+2013-11-21 Anders Carlsson <[email protected]>
+
+ Move page title handling to the page load state
+ https://bugs.webkit.org/show_bug.cgi?id=124748
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageCopyTitle):
+ * UIProcess/PageLoadState.cpp:
+ (WebKit::PageLoadState::reset):
+ (WebKit::PageLoadState::didCommitLoad):
+ (WebKit::PageLoadState::title):
+ (WebKit::PageLoadState::setTitle):
+ * UIProcess/PageLoadState.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didReceiveTitleForFrame):
+ * UIProcess/WebPageProxy.h:
+
2013-11-21 Daniel Bates <[email protected]>
Remove unused functions from WebCore and WebKit2
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (159655 => 159656)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2013-11-22 01:13:02 UTC (rev 159656)
@@ -215,7 +215,7 @@
WKStringRef WKPageCopyTitle(WKPageRef pageRef)
{
- return toCopiedAPI(toImpl(pageRef)->pageTitle());
+ return toCopiedAPI(toImpl(pageRef)->pageLoadState().title());
}
WKFrameRef WKPageGetMainFrame(WKPageRef pageRef)
Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.cpp (159655 => 159656)
--- trunk/Source/WebKit2/UIProcess/PageLoadState.cpp 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.cpp 2013-11-22 01:13:02 UTC (rev 159656)
@@ -46,6 +46,8 @@
m_unreachableURL = String();
m_lastUnreachableURL = String();
+
+ m_title = String();
}
String PageLoadState::activeURL() const
@@ -120,6 +122,8 @@
m_state = State::Committed;
m_url = m_provisionalURL;
m_provisionalURL = String();
+
+ m_title = String();
}
void PageLoadState::didFinishLoad()
@@ -150,4 +154,14 @@
m_unreachableURL = unreachableURL;
}
+const String& PageLoadState::title() const
+{
+ return m_title;
+}
+
+void PageLoadState::setTitle(const String& title)
+{
+ m_title = title;
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.h (159655 => 159656)
--- trunk/Source/WebKit2/UIProcess/PageLoadState.h 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.h 2013-11-22 01:13:02 UTC (rev 159656)
@@ -41,6 +41,11 @@
Finished
};
+ class Observer {
+ public:
+ virtual ~Observer() { }
+
+ }
void reset();
const String& provisionalURL() const { return m_provisionalURL; }
@@ -65,6 +70,9 @@
void setUnreachableURL(const String&);
+ const String& title() const;
+ void setTitle(const String&);
+
private:
State m_state;
@@ -75,6 +83,8 @@
String m_unreachableURL;
String m_lastUnreachableURL;
+
+ String m_title;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159655 => 159656)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-11-22 01:13:02 UTC (rev 159656)
@@ -1443,16 +1443,6 @@
m_process->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
}
-String WebPageProxy::pageTitle() const
-{
- // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
- // crashed, page has been closed).
- if (!m_mainFrame)
- return String();
-
- return m_mainFrame->title();
-}
-
void WebPageProxy::setUserAgent(const String& userAgent)
{
if (m_userAgent == userAgent)
@@ -2274,6 +2264,9 @@
WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
+ if (frame->isMainFrame())
+ m_pageLoadState.setTitle(title);
+
frame->didChangeTitle(title);
m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (159655 => 159656)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-11-22 01:11:54 UTC (rev 159655)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-11-22 01:13:02 UTC (rev 159656)
@@ -409,7 +409,6 @@
void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
void centerSelectionInVisibleArea();
- String pageTitle() const;
const String& toolTip() const { return m_toolTip; }
void setUserAgent(const String&);