summaryrefslogtreecommitdiffstats
path: root/WebCore/page
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-05 14:27:46 +0000
committerSteve Block <steveblock@google.com>2010-02-15 10:49:50 +0000
commit5e2bc6953fe6923165b8a5d7679939693a1d58d6 (patch)
tree6ccb8c24bc2bf5e8f413e6cfae250b729b426631 /WebCore/page
parent4a00f4fccc3cb7e9996749a05631f5d7b9de756e (diff)
downloadexternal_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.zip
external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.gz
external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.bz2
Merge webkit.org at r54340 : Initial merge by git
Change-Id: Ib489d2ff91186ea3652522e1d586e54416a2cf44
Diffstat (limited to 'WebCore/page')
-rw-r--r--WebCore/page/Console.cpp32
-rw-r--r--WebCore/page/Console.h154
-rw-r--r--WebCore/page/Console.idl4
-rw-r--r--WebCore/page/DOMWindow.cpp2
-rw-r--r--WebCore/page/EventHandler.h8
-rw-r--r--WebCore/page/Page.cpp7
-rw-r--r--WebCore/page/PageGroup.cpp2
-rw-r--r--WebCore/page/PrintContext.cpp71
-rw-r--r--WebCore/page/PrintContext.h9
-rw-r--r--WebCore/page/XSSAuditor.cpp26
-rw-r--r--WebCore/page/XSSAuditor.h6
-rw-r--r--WebCore/page/mac/EventHandlerMac.mm61
-rw-r--r--WebCore/page/win/FrameWin.cpp58
-rw-r--r--WebCore/page/win/FrameWin.h2
14 files changed, 274 insertions, 168 deletions
diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp
index 2273a5e..8f55c78 100644
--- a/WebCore/page/Console.cpp
+++ b/WebCore/page/Console.cpp
@@ -41,11 +41,9 @@
#include "PageGroup.h"
#include "PlatformString.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include <profiler/Profiler.h>
-#endif
-
#include "ScriptCallStack.h"
+#include "ScriptProfile.h"
+#include "ScriptProfiler.h"
#include <stdio.h>
#include <wtf/UnusedParam.h>
@@ -314,38 +312,40 @@ String Console::lastWMLErrorMessage() const
}
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+// FIXME: "USE(V8)" and "USE(JSC)" below are temporary measures until JAVASCRIPT_DEBUGGER is
+// enabled when building Chromium.
+#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8)
-void Console::profile(const JSC::UString& title, ScriptCallStack* callStack)
+void Console::profile(const String& title, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
return;
-#if ENABLE(INSPECTOR)
+#if ENABLE(INSPECTOR) && USE(JSC)
InspectorController* controller = page->inspectorController();
// FIXME: log a console message when profiling is disabled.
if (!controller->profilerEnabled())
return;
#endif
- JSC::UString resolvedTitle = title;
- if (title.isNull()) // no title so give it the next user initiated profile title.
-#if ENABLE(INSPECTOR)
+ String resolvedTitle = title;
+ if (title.isNull()) // no title so give it the next user initiated profile title.
+#if ENABLE(INSPECTOR) && USE(JSC)
resolvedTitle = controller->getCurrentUserInitiatedProfileName(true);
#else
resolvedTitle = "";
#endif
- JSC::Profiler::profiler()->startProfiling(callStack->state(), resolvedTitle);
+ ScriptProfiler::start(callStack->state(), resolvedTitle);
-#if ENABLE(INSPECTOR)
+#if ENABLE(INSPECTOR) && USE(JSC)
const ScriptCallFrame& lastCaller = callStack->at(0);
controller->addStartProfilingMessageToConsole(resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL());
#endif
}
-void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack)
+void Console::profileEnd(const String& title, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
@@ -354,19 +354,19 @@ void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack)
if (!this->page())
return;
-#if ENABLE(INSPECTOR)
+#if ENABLE(INSPECTOR) && USE(JSC)
InspectorController* controller = page->inspectorController();
if (!controller->profilerEnabled())
return;
#endif
- RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(callStack->state(), title);
+ RefPtr<ScriptProfile> profile = ScriptProfiler::stop(callStack->state(), title);
if (!profile)
return;
m_profiles.append(profile);
-#if ENABLE(INSPECTOR)
+#if ENABLE(INSPECTOR) && USE(JSC)
const ScriptCallFrame& lastCaller = callStack->at(0);
controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
#endif
diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h
index ea3a161..bbf2ac7 100644
--- a/WebCore/page/Console.h
+++ b/WebCore/page/Console.h
@@ -31,101 +31,101 @@
#include "PlatformString.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include <profiler/Profile.h>
-#endif
+#include "ScriptProfile.h"
-#include <wtf/RefCounted.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
namespace WebCore {
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- typedef Vector<RefPtr<JSC::Profile> > ProfilesArray;
+// FIXME: "USE(V8)" and "USE(JSC)" below are temporary measures until JAVASCRIPT_DEBUGGER is
+// enabled when building Chromium.
+#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8)
+typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
#endif
- class Frame;
- class Page;
- class String;
- class ScriptCallStack;
-
- // Keep in sync with inspector/front-end/Console.js
- enum MessageSource {
- HTMLMessageSource,
- WMLMessageSource,
- XMLMessageSource,
- JSMessageSource,
- CSSMessageSource,
- OtherMessageSource
- };
-
- enum MessageType {
- LogMessageType,
- ObjectMessageType,
- TraceMessageType,
- StartGroupMessageType,
- EndGroupMessageType,
- AssertMessageType
- };
-
- enum MessageLevel {
- TipMessageLevel,
- LogMessageLevel,
- WarningMessageLevel,
- ErrorMessageLevel,
- DebugMessageLevel
- };
-
- class Console : public RefCounted<Console> {
- public:
- static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
-
- Frame* frame() const;
- void disconnectFrame();
-
- void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
-
- void debug(ScriptCallStack*);
- void error(ScriptCallStack*);
- void info(ScriptCallStack*);
- void log(ScriptCallStack*);
- void warn(ScriptCallStack*);
- void dir(ScriptCallStack*);
- void dirxml(ScriptCallStack*);
- void trace(ScriptCallStack*);
- void assertCondition(bool condition, ScriptCallStack*);
- void count(ScriptCallStack*);
- void markTimeline(ScriptCallStack*);
+class Frame;
+class Page;
+class String;
+class ScriptCallStack;
+
+// Keep in sync with inspector/front-end/Console.js
+enum MessageSource {
+ HTMLMessageSource,
+ WMLMessageSource,
+ XMLMessageSource,
+ JSMessageSource,
+ CSSMessageSource,
+ OtherMessageSource
+};
+
+enum MessageType {
+ LogMessageType,
+ ObjectMessageType,
+ TraceMessageType,
+ StartGroupMessageType,
+ EndGroupMessageType,
+ AssertMessageType
+};
+
+enum MessageLevel {
+ TipMessageLevel,
+ LogMessageLevel,
+ WarningMessageLevel,
+ ErrorMessageLevel,
+ DebugMessageLevel
+};
+
+class Console : public RefCounted<Console> {
+public:
+ static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
+
+ Frame* frame() const;
+ void disconnectFrame();
+
+ void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+
+ void debug(ScriptCallStack*);
+ void error(ScriptCallStack*);
+ void info(ScriptCallStack*);
+ void log(ScriptCallStack*);
+ void warn(ScriptCallStack*);
+ void dir(ScriptCallStack*);
+ void dirxml(ScriptCallStack*);
+ void trace(ScriptCallStack*);
+ void assertCondition(bool condition, ScriptCallStack*);
+ void count(ScriptCallStack*);
+ void markTimeline(ScriptCallStack*);
#if ENABLE(WML)
- String lastWMLErrorMessage() const;
+ String lastWMLErrorMessage() const;
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- void profile(const JSC::UString&, ScriptCallStack*);
- void profileEnd(const JSC::UString&, ScriptCallStack*);
+#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8)
+ void profile(const String&, ScriptCallStack*);
+ void profileEnd(const String&, ScriptCallStack*);
#endif
- void time(const String&);
- void timeEnd(const String&, ScriptCallStack*);
- void group(ScriptCallStack*);
- void groupEnd();
+ void time(const String&);
+ void timeEnd(const String&, ScriptCallStack*);
+ void group(ScriptCallStack*);
+ void groupEnd();
- static bool shouldPrintExceptions();
- static void setShouldPrintExceptions(bool);
+ static bool shouldPrintExceptions();
+ static void setShouldPrintExceptions(bool);
#if ENABLE(JAVASCRIPT_DEBUGGER)
- const ProfilesArray& profiles() const { return m_profiles; }
+ const ProfilesArray& profiles() const { return m_profiles; }
#endif
- private:
- inline Page* page() const;
- void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
+private:
+ inline Page* page() const;
+ void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
- Console(Frame*);
+ Console(Frame*);
- Frame* m_frame;
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- ProfilesArray m_profiles;
+ Frame* m_frame;
+#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8)
+ ProfilesArray m_profiles;
#endif
- };
+};
} // namespace WebCore
diff --git a/WebCore/page/Console.idl b/WebCore/page/Console.idl
index b9c0a57..290235b 100644
--- a/WebCore/page/Console.idl
+++ b/WebCore/page/Console.idl
@@ -51,8 +51,8 @@ module window {
#endif
#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER || defined(V8_BINDING) && V8_BINDING
- [Custom] void profile(in [ConvertUndefinedOrNullToNullString] DOMString title);
- [Custom] void profileEnd(in [ConvertUndefinedOrNullToNullString] DOMString title);
+ [CustomArgumentHandling] void profile(in [ConvertUndefinedOrNullToNullString] DOMString title);
+ [CustomArgumentHandling] void profileEnd(in [ConvertUndefinedOrNullToNullString] DOMString title);
#endif
void time(in [ConvertUndefinedOrNullToNullString] DOMString title);
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 3eb2b8e..2f0f84f 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -342,8 +342,6 @@ void DOMWindow::parseModalDialogFeatures(const String& featuresArg, HashMap<Stri
bool DOMWindow::allowPopUp(Frame* activeFrame)
{
ASSERT(activeFrame);
- if (activeFrame->script()->processingUserGesture())
- return true;
Settings* settings = activeFrame->settings();
return settings && settings->javaScriptCanOpenWindowsAutomatically();
}
diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h
index f267ef5..861dce9 100644
--- a/WebCore/page/EventHandler.h
+++ b/WebCore/page/EventHandler.h
@@ -33,7 +33,7 @@
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
-#if PLATFORM(MAC) && !defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE)
+#if PLATFORM(MAC) && !defined(__OBJC__)
class NSView;
#endif
@@ -183,7 +183,7 @@ public:
void sendResizeEvent();
void sendScrollEvent();
-#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE)
+#if PLATFORM(MAC) && defined(__OBJC__)
PassRefPtr<KeyboardEvent> currentKeyboardEvent() const;
void mouseDown(NSEvent *);
@@ -415,9 +415,11 @@ private:
RefPtr<Node> m_previousWheelScrolledNode;
-#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE)
+#if PLATFORM(MAC)
+#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE)
NSView *m_mouseDownView;
bool m_sendingEventToSubview;
+#endif
int m_activationEventNumber;
#endif
#if ENABLE(TOUCH_EVENTS)
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index b685e59..a3e89b5 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -69,7 +69,7 @@
#include "StorageNamespace.h"
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptDebugServer.h"
#endif
@@ -191,7 +191,7 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
JavaScriptDebugServer::shared().pageCreated(this);
#endif
@@ -308,7 +308,8 @@ void Page::goBackOrForward(int distance)
void Page::goToItem(HistoryItem* item, FrameLoadType type)
{
// Abort any current load unless we're navigating the current document to a new state object
- if (!item->stateObject() || item->documentSequenceNumber() != m_mainFrame->loader()->history()->currentItem()->documentSequenceNumber()) {
+ HistoryItem* currentItem = m_mainFrame->loader()->history()->currentItem();
+ if (!item->stateObject() || !currentItem || item->documentSequenceNumber() != currentItem->documentSequenceNumber()) {
// Define what to do with any open database connections. By default we stop them and terminate the database thread.
DatabasePolicy databasePolicy = DatabasePolicyStop;
diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp
index 0ebbfba..f376d52 100644
--- a/WebCore/page/PageGroup.cpp
+++ b/WebCore/page/PageGroup.cpp
@@ -51,7 +51,7 @@ static unsigned getUniqueIdentifier()
// --------
-static bool shouldTrackVisitedLinks;
+static bool shouldTrackVisitedLinks = false;
PageGroup::PageGroup(const String& name)
: m_name(name)
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 4d3a839..4c902a9 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -45,6 +45,11 @@ int PrintContext::pageCount() const
return m_pageRects.size();
}
+const IntRect& PrintContext::pageRect(int pageNumber) const
+{
+ return m_pageRects[pageNumber];
+}
+
void PrintContext::computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight)
{
m_pageRects.clear();
@@ -60,11 +65,6 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
return;
}
- if (userScaleFactor <= 0) {
- LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor);
- return;
- }
-
float ratio = printRect.height() / printRect.width();
float pageWidth = (float)root->rightLayoutOverflow();
@@ -77,14 +77,31 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
return;
}
- float currPageHeight = pageHeight / userScaleFactor;
+ computePageRectsWithPageSize(FloatSize(pageWidth, pageHeight), userScaleFactor);
+}
+
+void PrintContext::computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor)
+{
+ RenderView* root = toRenderView(m_frame->document()->renderer());
+
+ if (!root) {
+ LOG_ERROR("document to be printed has no renderer");
+ return;
+ }
+
+ if (userScaleFactor <= 0) {
+ LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor);
+ return;
+ }
+
+ float currPageHeight = pageSizeInPixels.height() / userScaleFactor;
float docHeight = root->layer()->height();
- float currPageWidth = pageWidth / userScaleFactor;
+ float currPageWidth = pageSizeInPixels.width() / userScaleFactor;
// always return at least one page, since empty files should print a blank page
- float printedPagesHeight = 0.0;
+ float printedPagesHeight = 0;
do {
- float proposedBottom = std::min(docHeight, printedPagesHeight + pageHeight);
+ float proposedBottom = std::min(docHeight, printedPagesHeight + pageSizeInPixels.height());
m_frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight);
currPageHeight = max(1.0f, proposedBottom - printedPagesHeight);
@@ -134,4 +151,40 @@ void PrintContext::end()
m_frame->setPrinting(false, 0, 0, true);
}
+static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object)
+{
+
+ while (object && !object->isBoxModelObject())
+ object = object->parent();
+ if (!object)
+ return 0;
+ return toRenderBoxModelObject(object);
+}
+
+int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSizeInPixels)
+{
+ // Make sure the element is not freed during the layout.
+ RefPtr<Element> elementRef(element);
+ element->document()->updateLayout();
+
+ RenderBoxModelObject* box = enclosingBoxModelObject(element->renderer());
+ if (!box)
+ return -1;
+
+ Frame* frame = element->document()->frame();
+ FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
+ PrintContext printContext(frame);
+ printContext.begin(pageRect.width());
+ printContext.computePageRectsWithPageSize(pageSizeInPixels, 1);
+
+ int top = box->offsetTop();
+ int left = box->offsetLeft();
+ for (int pageNumber = 0; pageNumber < printContext.pageCount(); pageNumber++) {
+ const IntRect& page = printContext.pageRect(pageNumber);
+ if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom())
+ return pageNumber;
+ }
+ return -1;
+}
+
}
diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h
index 0b3b303..38b28c4 100644
--- a/WebCore/page/PrintContext.h
+++ b/WebCore/page/PrintContext.h
@@ -25,8 +25,10 @@
namespace WebCore {
+class Element;
class Frame;
class FloatRect;
+class FloatSize;
class GraphicsContext;
class IntRect;
@@ -36,6 +38,8 @@ public:
~PrintContext();
int pageCount() const;
+ const IntRect& pageRect(int pageNumber) const;
+ const Vector<IntRect>& pageRects() const { return m_pageRects; }
void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight);
@@ -47,7 +51,12 @@ public:
void end();
+ // Used by layout tests.
+ static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels);
+
protected:
+ void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor);
+
Frame* m_frame;
Vector<IntRect> m_pageRects;
};
diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp
index 0129b52..b71fa49 100644
--- a/WebCore/page/XSSAuditor.cpp
+++ b/WebCore/page/XSSAuditor.cpp
@@ -290,14 +290,38 @@ bool XSSAuditor::isSameOriginResource(const String& url) const
return (m_frame->document()->url().host() == resourceURL.host() && resourceURL.query().isEmpty());
}
+bool XSSAuditor::shouldFullPageBlockForXSSProtectionHeader() const
+{
+ // If we detect an XSS attack and find the HTTP header "X-XSS-Protection: 12" then
+ // we will stop loading the page as opposed to ignoring the script. The value "12"
+ // came from a personal communication, see <https://bugs.webkit.org/show_bug.cgi?id=27312>
+ // for more details.
+ DEFINE_STATIC_LOCAL(String, XSSProtectionHeader, ("X-XSS-Protection"));
+
+ Frame* frame = m_frame;
+ if (frame->document()->url() == blankURL())
+ frame = m_frame->tree()->parent();
+
+ // We strip any whitespace characters to conform to the behavior in Internet Explorer.
+ String xssProtectionValue = frame->loader()->documentLoader()->response().httpHeaderField(XSSProtectionHeader).stripWhiteSpace();
+ return (xssProtectionValue.length() >= 2 && xssProtectionValue[0] == '1' && xssProtectionValue[1] == '2');
+}
+
bool XSSAuditor::findInRequest(const FindTask& task) const
{
bool result = false;
Frame* parentFrame = m_frame->tree()->parent();
+ Frame* blockFrame = parentFrame;
if (parentFrame && m_frame->document()->url() == blankURL())
result = findInRequest(parentFrame, task);
- if (!result)
+ if (!result) {
result = findInRequest(m_frame, task);
+ blockFrame = m_frame;
+ }
+ if (result && blockFrame && shouldFullPageBlockForXSSProtectionHeader()) {
+ blockFrame->loader()->stopAllLoaders();
+ blockFrame->redirectScheduler()->scheduleLocationChange(blankURL(), String());
+ }
return result;
}
diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h
index d976f52..3ad50a1 100644
--- a/WebCore/page/XSSAuditor.h
+++ b/WebCore/page/XSSAuditor.h
@@ -36,7 +36,7 @@ namespace WebCore {
class ScriptSourceCode;
// The XSSAuditor class is used to prevent type 1 cross-site scripting
- // vulnerabilites (also known as reflected vulnerabilities).
+ // vulnerabilities (also known as reflected vulnerabilities).
//
// More specifically, the XSSAuditor class decides whether the execution of
// a script is to be allowed or denied based on the content of any
@@ -53,7 +53,7 @@ namespace WebCore {
//
// Bindings
//
- // An XSSAuditor is instantiated within the contructor of a
+ // An XSSAuditor is instantiated within the constructor of a
// ScriptController object and passed the Frame the script originated. The
// ScriptController calls back to the XSSAuditor to determine whether a
// JavaScript script is safe to execute before executing it. The following
@@ -144,6 +144,8 @@ namespace WebCore {
bool findInRequest(const FindTask&) const;
bool findInRequest(Frame*, const FindTask&) const;
+ bool shouldFullPageBlockForXSSProtectionHeader() const;
+
// The frame to audit.
Frame* m_frame;
diff --git a/WebCore/page/mac/EventHandlerMac.mm b/WebCore/page/mac/EventHandlerMac.mm
index 91a2018..650c0e1 100644
--- a/WebCore/page/mac/EventHandlerMac.mm
+++ b/WebCore/page/mac/EventHandlerMac.mm
@@ -663,6 +663,11 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
#else // ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE)
+NSEvent *EventHandler::currentNSEvent()
+{
+ return 0;
+}
+
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
{
subframe->eventHandler()->handleMousePressEvent(mev.event());
@@ -711,6 +716,62 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
return false;
}
+PassRefPtr<KeyboardEvent> EventHandler::currentKeyboardEvent() const
+{
+ return 0;
+}
+
+void EventHandler::mouseDown(NSEvent *)
+{
+ notImplemented();
+}
+
+void EventHandler::mouseDragged(NSEvent *)
+{
+ notImplemented();
+}
+
+void EventHandler::mouseUp(NSEvent *)
+{
+ notImplemented();
+}
+
+void EventHandler::mouseMoved(NSEvent *)
+{
+ notImplemented();
+}
+
+bool EventHandler::keyEvent(NSEvent *)
+{
+ notImplemented();
+ return false;
+}
+
+bool EventHandler::wheelEvent(NSEvent *)
+{
+ notImplemented();
+ return false;
+}
+
+#if ENABLE(CONTEXT_MENUS)
+bool EventHandler::sendContextMenuEvent(NSEvent *)
+{
+ notImplemented();
+ return false;
+}
+#endif
+
+bool EventHandler::eventMayStartDrag(NSEvent *)
+{
+ notImplemented();
+ return false;
+}
+
+void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *)
+{
+}
+
+
#endif
#if ENABLE(DRAG_SUPPORT)
diff --git a/WebCore/page/win/FrameWin.cpp b/WebCore/page/win/FrameWin.cpp
index 8440a80..2b5435d 100644
--- a/WebCore/page/win/FrameWin.cpp
+++ b/WebCore/page/win/FrameWin.cpp
@@ -29,64 +29,20 @@
#include "Bridge.h"
#include "Document.h"
#include "FloatRect.h"
+#include "PrintContext.h"
#include "RenderView.h"
#include "Settings.h"
#include "TransformationMatrix.h"
-using std::min;
-
namespace WebCore {
-void computePageRectsForFrame(Frame* frame, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& pages, int& outPageHeight)
+void computePageRectsForFrame(Frame* frame, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& outPages, int& outPageHeight)
{
- ASSERT(frame);
-
- pages.clear();
- outPageHeight = 0;
-
- if (!frame->document() || !frame->view() || !frame->document()->renderer())
- return;
-
- RenderView* root = toRenderView(frame->document()->renderer());
-
- if (!root) {
- LOG_ERROR("document to be printed has no renderer");
- return;
- }
-
- if (userScaleFactor <= 0) {
- LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor);
- return;
- }
-
- float ratio = static_cast<float>(printRect.height()) / static_cast<float>(printRect.width());
-
- float pageWidth = static_cast<float>(root->rightLayoutOverflow());
- float pageHeight = pageWidth * ratio;
- outPageHeight = static_cast<int>(pageHeight); // this is the height of the page adjusted by margins
- pageHeight -= (headerHeight + footerHeight);
-
- if (pageHeight <= 0) {
- LOG_ERROR("pageHeight has bad value %.2f", pageHeight);
- return;
- }
-
- float currPageHeight = pageHeight / userScaleFactor;
- float docHeight = root->layer()->height();
- float docWidth = root->layer()->width();
- float currPageWidth = pageWidth / userScaleFactor;
-
-
- // always return at least one page, since empty files should print a blank page
- float printedPagesHeight = 0.0f;
- do {
- float proposedBottom = min(docHeight, printedPagesHeight + pageHeight);
- frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight);
- currPageHeight = max(1.0f, proposedBottom - printedPagesHeight);
-
- pages.append(IntRect(0, printedPagesHeight, currPageWidth, currPageHeight));
- printedPagesHeight += currPageHeight;
- } while (printedPagesHeight < docHeight);
+ PrintContext printContext(frame);
+ float pageHeight = 0;
+ printContext.computePageRects(printRect, headerHeight, footerHeight, userScaleFactor, pageHeight);
+ outPageHeight = static_cast<int>(pageHeight);
+ outPages = printContext.pageRects();
}
DragImageRef Frame::dragImageForSelection()
diff --git a/WebCore/page/win/FrameWin.h b/WebCore/page/win/FrameWin.h
index 9cf9683..4c274b7 100644
--- a/WebCore/page/win/FrameWin.h
+++ b/WebCore/page/win/FrameWin.h
@@ -37,7 +37,7 @@ namespace WebCore {
class IntRect;
HBITMAP imageFromSelection(Frame* frame, bool forceWhiteText);
- void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& pages, int& pageHeight);
+ void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& outPages, int& outPageHeight);
}