summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/page/DOMWindow.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebCore/page/DOMWindow.cpp
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebCore/page/DOMWindow.cpp')
-rw-r--r--Source/WebCore/page/DOMWindow.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index 0860d65..c732a10 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -37,6 +37,7 @@
#include "CSSStyleSelector.h"
#include "Chrome.h"
#include "Console.h"
+#include "Crypto.h"
#include "DOMApplicationCache.h"
#include "DOMSelection.h"
#include "DOMSettableTokenList.h"
@@ -342,8 +343,8 @@ void DOMWindow::adjustWindowRect(const FloatRect& screen, FloatRect& window, con
window.setHeight(min(max(100.0f, window.height()), screen.height()));
// Constrain the window position to the screen.
- window.setX(max(screen.x(), min(window.x(), screen.right() - window.width())));
- window.setY(max(screen.y(), min(window.y(), screen.bottom() - window.height())));
+ window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
+ window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())));
}
// FIXME: We can remove this function once V8 showModalDialog is changed to use DOMWindow.
@@ -433,6 +434,8 @@ void DOMWindow::clear()
m_history->disconnectFrame();
m_history = 0;
+ m_crypto = 0;
+
if (m_locationbar)
m_locationbar->disconnectFrame();
m_locationbar = 0;
@@ -530,6 +533,13 @@ History* DOMWindow::history() const
return m_history.get();
}
+Crypto* DOMWindow::crypto() const
+{
+ if (!m_crypto)
+ m_crypto = Crypto::create();
+ return m_crypto.get();
+}
+
BarInfo* DOMWindow::locationbar() const
{
if (!m_locationbar)
@@ -964,33 +974,17 @@ String DOMWindow::prompt(const String& message, const String& defaultValue)
return String();
}
-static bool isSafeToConvertCharList(const String& string)
-{
- for (unsigned i = 0; i < string.length(); i++) {
- if (string[i] > 0xFF)
- return false;
- }
-
- return true;
-}
-
String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec)
{
if (stringToEncode.isNull())
return String();
- if (!isSafeToConvertCharList(stringToEncode)) {
+ if (!stringToEncode.containsOnlyLatin1()) {
ec = INVALID_CHARACTER_ERR;
return String();
}
- Vector<char> in;
- in.append(stringToEncode.characters(), stringToEncode.length());
- Vector<char> out;
-
- base64Encode(in, out);
-
- return String(out.data(), out.size());
+ return base64Encode(stringToEncode.latin1());
}
String DOMWindow::atob(const String& encodedString, ExceptionCode& ec)
@@ -998,7 +992,7 @@ String DOMWindow::atob(const String& encodedString, ExceptionCode& ec)
if (encodedString.isNull())
return String();
- if (!isSafeToConvertCharList(encodedString)) {
+ if (!encodedString.containsOnlyLatin1()) {
ec = INVALID_CHARACTER_ERR;
return String();
}
@@ -1557,7 +1551,7 @@ void DOMWindow::dispatchLoadEvent()
ownerElement->dispatchGenericEvent(ownerEvent.release());
}
- InspectorInstrumentation::mainResourceFiredLoadEvent(frame(), url());
+ InspectorInstrumentation::loadEventFired(frame(), url());
}
bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
@@ -1585,7 +1579,6 @@ void DOMWindow::dispatchTimedEvent(PassRefPtr<Event> event, Document* target, do
*startTime = currentTime();
dispatchEvent(event, target);
*endTime = currentTime();
- ASSERT(*endTime >= *startTime);
}
void DOMWindow::removeAllEventListeners()