diff options
Diffstat (limited to 'WebCore/page')
-rw-r--r-- | WebCore/page/ChromeClient.h | 2 | ||||
-rw-r--r-- | WebCore/page/DOMWindow.cpp | 16 | ||||
-rw-r--r-- | WebCore/page/DOMWindow.h | 14 | ||||
-rw-r--r-- | WebCore/page/DOMWindow.idl | 12 | ||||
-rw-r--r-- | WebCore/page/EventHandler.cpp | 76 | ||||
-rw-r--r-- | WebCore/page/EventHandler.h | 1 | ||||
-rw-r--r-- | WebCore/page/FocusController.cpp | 2 | ||||
-rw-r--r-- | WebCore/page/Frame.cpp | 1 | ||||
-rw-r--r-- | WebCore/page/FrameView.cpp | 6 | ||||
-rw-r--r-- | WebCore/page/Navigation.cpp | 73 | ||||
-rw-r--r-- | WebCore/page/Navigation.h | 62 | ||||
-rw-r--r-- | WebCore/page/Navigation.idl | 47 | ||||
-rw-r--r-- | WebCore/page/Performance.cpp | 84 | ||||
-rw-r--r-- | WebCore/page/Performance.h | 65 | ||||
-rw-r--r-- | WebCore/page/Performance.idl | 39 | ||||
-rw-r--r-- | WebCore/page/PrintContext.cpp | 18 | ||||
-rw-r--r-- | WebCore/page/PrintContext.h | 3 | ||||
-rw-r--r-- | WebCore/page/Settings.cpp | 10 | ||||
-rw-r--r-- | WebCore/page/Settings.h | 16 | ||||
-rw-r--r-- | WebCore/page/SpatialNavigation.cpp | 20 | ||||
-rw-r--r-- | WebCore/page/SpatialNavigation.h | 1 | ||||
-rw-r--r-- | WebCore/page/Timing.cpp | 65 | ||||
-rw-r--r-- | WebCore/page/Timing.h | 61 | ||||
-rw-r--r-- | WebCore/page/Timing.idl | 39 | ||||
-rw-r--r-- | WebCore/page/XSSAuditor.cpp | 6 |
25 files changed, 722 insertions, 17 deletions
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index 6e20969..660ec68 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -43,6 +43,7 @@ class NSResponder; namespace WebCore { class AtomicString; + class Element; class FileChooser; class FloatRect; class Frame; @@ -146,6 +147,7 @@ namespace WebCore { // End methods used by HostWindow. virtual void scrollbarsModeDidChange() const = 0; + virtual void missingPluginButtonClicked(Element*) const { } virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0; virtual void setToolTip(const String&, TextDirection) = 0; diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index d234973..f050a80 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -65,6 +65,7 @@ #include "NotificationCenter.h" #include "Page.h" #include "PageGroup.h" +#include "Performance.h" #include "PlatformScreen.h" #include "PlatformString.h" #include "Screen.h" @@ -442,6 +443,12 @@ void DOMWindow::clear() m_navigator->disconnectFrame(); m_navigator = 0; +#if ENABLE(WEB_TIMING) + if (m_performance) + m_performance->disconnectFrame(); + m_performance = 0; +#endif + if (m_location) m_location->disconnectFrame(); m_location = 0; @@ -566,6 +573,15 @@ Navigator* DOMWindow::navigator() const return m_navigator.get(); } +#if ENABLE(WEB_TIMING) +Performance* DOMWindow::webkitPerformance() const +{ + if (!m_performance) + m_performance = Performance::create(m_frame); + return m_performance.get(); +} +#endif + Location* DOMWindow::location() const { if (!m_location) diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 4765b31..beb2f7d 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -60,6 +60,11 @@ namespace WebCore { class Navigator; class Node; class NotificationCenter; + +#if ENABLE(WEB_TIMING) + class Performance; +#endif + class PostMessageTimer; class ScheduledAction; class SerializedScriptValue; @@ -125,6 +130,9 @@ namespace WebCore { BarInfo* toolbar() const; Navigator* navigator() const; Navigator* clientInformation() const { return navigator(); } +#if ENABLE(WEB_TIMING) + Performance* webkitPerformance() const; +#endif Location* location() const; DOMSelection* getSelection(); @@ -356,6 +364,9 @@ namespace WebCore { BarInfo* optionalToolbar() const { return m_toolbar.get(); } Console* optionalConsole() const { return m_console.get(); } Navigator* optionalNavigator() const { return m_navigator.get(); } +#if ENABLE(WEB_TIMING) + Performance* optionalWebkitPerformance() const { return m_performance.get(); } +#endif Location* optionalLocation() const { return m_location.get(); } StyleMedia* optionalMedia() const { return m_media.get(); } #if ENABLE(DOM_STORAGE) @@ -393,6 +404,9 @@ namespace WebCore { mutable RefPtr<BarInfo> m_toolbar; mutable RefPtr<Console> m_console; mutable RefPtr<Navigator> m_navigator; +#if ENABLE(WEB_TIMING) + mutable RefPtr<Performance> m_performance; +#endif mutable RefPtr<Location> m_location; mutable RefPtr<StyleMedia> m_media; #if ENABLE(DOM_STORAGE) diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index 5b1000a..20eab8b 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -195,6 +195,11 @@ module window { raises(DOMException); #endif +#if defined(ENABLE_WEB_TIMING) && ENABLE_WEB_TIMING + // FIXME: Remove vendor prefix. + readonly attribute Performance webkitPerformance; +#endif + // Timers [Custom] long setTimeout(in TimeoutHandler handler, in long timeout); // [Custom] long setTimeout(in TimeoutHandler handler, in long timeout, arguments...); @@ -456,6 +461,10 @@ module window { attribute [Conditional=3D_CANVAS,EnabledAtRuntime] WebGLRenderingContextConstructor WebGLRenderingContext; attribute TextMetricsConstructor TextMetrics; +#if !defined(V8_BINDING) || !V8_BINDING + attribute DOMStringMapConstructor DOMStringMap; +#endif + attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] ArrayBufferConstructor ArrayBuffer; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int8ArrayConstructor Int8Array; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint8ArrayConstructor Uint8Array; // Usable with new operator @@ -706,7 +715,7 @@ module window { attribute SVGFEColorMatrixElementConstructor SVGFEColorMatrixElement; attribute SVGFEComponentTransferElementConstructor SVGFEComponentTransferElement; attribute SVGFECompositeElementConstructor SVGFECompositeElement; -// attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement; + attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement; attribute SVGFEDiffuseLightingElementConstructor SVGFEDiffuseLightingElement; attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement; attribute SVGFEDistantLightElementConstructor SVGFEDistantLightElement; @@ -752,3 +761,4 @@ module window { }; } + diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index c28b1a5..9fde92f 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -2035,10 +2035,84 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event) } #endif - swallowEvent = dispatchMouseEvent(eventNames().contextmenuEvent, mev.targetNode(), true, 0, event, true); + swallowEvent = dispatchMouseEvent(eventNames().contextmenuEvent, mev.targetNode(), true, 0, event, false); return swallowEvent; } + +bool EventHandler::sendContextMenuEventForKey() +{ + FrameView* view = m_frame->view(); + if (!view) + return false; + + Document* doc = m_frame->document(); + if (!doc) + return false; + + static const int kContextMenuMargin = 1; + +#if OS(WINDOWS) + int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); +#else + int rightAligned = 0; +#endif + IntPoint location; + + Node* focusedNode = doc->focusedNode(); + SelectionController* selectionController = m_frame->selection(); + Position start = selectionController->selection().start(); + + if (start.node() && (selectionController->rootEditableElement() || selectionController->isRange())) { + RenderObject* renderer = start.node()->renderer(); + if (!renderer) + return false; + + RefPtr<Range> selection = selectionController->toNormalizedRange(); + IntRect firstRect = m_frame->firstRectForRange(selection.get()); + + int x = rightAligned ? firstRect.right() : firstRect.x(); + location = IntPoint(x, firstRect.bottom()); + } else if (focusedNode) { + RenderBoxModelObject* box = focusedNode->renderBoxModelObject(); + IntRect clippedRect = box->absoluteClippedOverflowRect(); + location = clippedRect.bottomLeft(); + } else { + location = IntPoint( + rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin, + kContextMenuMargin); + } + + m_frame->view()->setCursor(pointerCursor()); + + IntPoint position = view->contentsToWindow(location); + IntPoint globalPosition = view->contentsToScreen(IntRect(location, IntSize())).location(); + + Node* targetNode = doc->focusedNode(); + if (!targetNode) + targetNode = doc; + + // Use the focused node as the target for hover and active. + HitTestResult result(position); + result.setInnerNode(targetNode); + HitTestRequest request(HitTestRequest::Active); + doc->renderView()->layer()->updateHoverActiveState(request, result); + doc->updateStyleIfNeeded(); + + // The contextmenu event is a mouse event even when invoked using the keyboard. + // This is required for web compatibility. + +#if OS(WINDOWS) + MouseEventType eventType = MouseEventReleased; +#else + MouseEventType eventType = MouseEventPressed; +#endif + + PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WTF::currentTime()); + + return dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, mouseEvent, false); +} + #endif // ENABLE(CONTEXT_MENUS) void EventHandler::scheduleHoverStateUpdate() diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index bf2003e..d24d803 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -161,6 +161,7 @@ public: #if ENABLE(CONTEXT_MENUS) bool sendContextMenuEvent(const PlatformMouseEvent&); + bool sendContextMenuEventForKey(); #endif void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; } diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp index e9f180b..6ecdffd 100644 --- a/WebCore/page/FocusController.cpp +++ b/WebCore/page/FocusController.cpp @@ -503,7 +503,7 @@ void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* fo if (!innerDocument) return; - descendantOfContainer = innerDocument == focusedNode->document(); + descendantOfContainer = isNodeDeepDescendantOfDocument(focusedNode, innerDocument); firstChild = innerDocument->firstChild(); // Scrollable block elements (e.g. <div>, etc) diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index 186ac62..5ae666e 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -156,6 +156,7 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader , m_isDisconnected(false) , m_excludeFromTextSearch(false) { + ASSERT(page); AtomicString::init(); HTMLNames::init(); QualifiedName::init(); diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 1508e07..dfbe7a2 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -694,8 +694,12 @@ void FrameView::layout(bool allowSubtree) RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0; Node* body = document->body(); if (body && body->renderer()) { +<<<<<<< HEAD if (body->hasTagName(framesetTag) && !m_frame->settings()->frameFlatteningEnabled()) { #if !defined(ANDROID_FLATTEN_IFRAME) && !defined(ANDROID_FLATTEN_FRAMESET) +======= + if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame->settings()->frameFlatteningEnabled()) { +>>>>>>> webkit.org at r62496 body->renderer()->setChildNeedsLayout(true); vMode = ScrollbarAlwaysOff; hMode = ScrollbarAlwaysOff; @@ -1372,7 +1376,7 @@ void FrameView::scheduleRelayout() // When frame flattening is enabled, the contents of the frame affects layout of the parent frames. // Also invalidate parent frame starting from the owner element of this frame. - if (m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer()) { + if (m_frame->settings() && m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer()) { if (m_frame->ownerElement()->hasTagName(iframeTag) || m_frame->ownerElement()->hasTagName(frameTag)) m_frame->ownerRenderer()->setNeedsLayout(true, true); } diff --git a/WebCore/page/Navigation.cpp b/WebCore/page/Navigation.cpp new file mode 100644 index 0000000..828f87e --- /dev/null +++ b/WebCore/page/Navigation.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Navigation.h" + +#if ENABLE(WEB_TIMING) + +#include "Frame.h" + +namespace WebCore { + +Navigation::Navigation(Frame* frame) + : m_frame(frame) +{ +} + +Frame* Navigation::frame() const +{ + return m_frame; +} + +void Navigation::disconnectFrame() +{ + m_frame = 0; +} + +unsigned short Navigation::type() const +{ + if (!m_frame) + return 0; + + return 0; // FIXME +} + +unsigned short Navigation::redirectCount() const +{ + if (!m_frame) + return 0; + + return 0; // FIXME +} + +} // namespace WebCore + +#endif // ENABLE(WEB_TIMING) diff --git a/WebCore/page/Navigation.h b/WebCore/page/Navigation.h new file mode 100644 index 0000000..5e0f7e6 --- /dev/null +++ b/WebCore/page/Navigation.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Navigation_h +#define Navigation_h + +#if ENABLE(WEB_TIMING) + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Frame; + +class Navigation : public RefCounted<Navigation> { +public: + static PassRefPtr<Navigation> create(Frame* frame) { return adoptRef(new Navigation(frame)); } + + Frame* frame() const; + void disconnectFrame(); + + unsigned short type() const; + unsigned short redirectCount() const; + +private: + Navigation(Frame*); + + Frame* m_frame; +}; + +} + +#endif // !ENABLE(WEB_TIMING) +#endif // !defined(Navigation_h) diff --git a/WebCore/page/Navigation.idl b/WebCore/page/Navigation.idl new file mode 100644 index 0000000..3ec20ad --- /dev/null +++ b/WebCore/page/Navigation.idl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module window { + + // See: http://dev.w3.org/2006/webapi/WebTiming/ + interface [Conditional=WEB_TIMING, OmitConstructor] Navigation { + const unsigned short NAVIGATION_OTHER = 0; + const unsigned short NAVIGATION_LINK = 1; + const unsigned short NAVIGATION_FORWARD_BACK = 2; + const unsigned short NAVIGATION_BROWSER = 3; + const unsigned short NAVIGATION_NEW_WINDOW = 4; + const unsigned short NAVIGATION_RELOAD = 5; + const unsigned short NAVIGATION_FRAME = 6; + readonly attribute unsigned short type; + + readonly attribute unsigned short redirectCount; + }; + +} diff --git a/WebCore/page/Performance.cpp b/WebCore/page/Performance.cpp new file mode 100644 index 0000000..c19ce8f --- /dev/null +++ b/WebCore/page/Performance.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Performance.h" + +#include "Navigation.h" +#include "Timing.h" + +#if ENABLE(WEB_TIMING) + +#include "Frame.h" + +namespace WebCore { + +Performance::Performance(Frame* frame) + : m_frame(frame) +{ +} + +Frame* Performance::frame() const +{ + return m_frame; +} + +void Performance::disconnectFrame() +{ + if (m_navigation) { + m_navigation->disconnectFrame(); + m_navigation = 0; + } + if (m_timing) { + m_timing->disconnectFrame(); + m_timing = 0; + } + m_frame = 0; +} + +Navigation* Performance::navigation() const +{ + if (!m_navigation) + m_navigation = Navigation::create(m_frame); + + return m_navigation.get(); +} + +Timing* Performance::timing() const +{ + if (!m_timing) + m_timing = Timing::create(m_frame); + + return m_timing.get(); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_TIMING) diff --git a/WebCore/page/Performance.h b/WebCore/page/Performance.h new file mode 100644 index 0000000..f317076 --- /dev/null +++ b/WebCore/page/Performance.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Performance_h +#define Performance_h + +#if ENABLE(WEB_TIMING) + +#include "Navigation.h" +#include "Timing.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class Performance : public RefCounted<Performance> { +public: + static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); } + + Frame* frame() const; + void disconnectFrame(); + + Navigation* navigation() const; + Timing* timing() const; + +private: + Performance(Frame*); + + mutable RefPtr<Navigation> m_navigation; + mutable RefPtr<Timing> m_timing; + Frame* m_frame; +}; + +} + +#endif // !ENABLE(WEB_TIMING) +#endif // !defined(Performance_h) diff --git a/WebCore/page/Performance.idl b/WebCore/page/Performance.idl new file mode 100644 index 0000000..3885e2c --- /dev/null +++ b/WebCore/page/Performance.idl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module window { + + // See: http://dev.w3.org/2006/webapi/WebTiming/ + interface [Conditional=WEB_TIMING, OmitConstructor] Performance { + readonly attribute Navigation navigation; + readonly attribute Timing timing; + }; + +} diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index 28c52bd..cc3707e 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -207,8 +207,11 @@ String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pa RefPtr<RenderStyle> style = document->styleForPage(pageNumber); // Implement formatters for properties we care about. - if (!strcmp(propertyName, "margin-left")) + if (!strcmp(propertyName, "margin-left")) { + if (style->marginLeft().isAuto()) + return String("auto"); return String::format("%d", style->marginLeft().rawValue()); + } if (!strcmp(propertyName, "line-height")) return String::format("%d", style->lineHeight().rawValue()); if (!strcmp(propertyName, "font-size")) @@ -224,16 +227,11 @@ bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber) return frame->document()->isPageBoxVisible(pageNumber); } -String PrintContext::pageAreaRectInPixels(Frame* frame, int pageNumber) -{ - IntRect pageArea = frame->document()->pageAreaRectInPixels(pageNumber); - return String::format("(%d,%d,%d,%d)", pageArea.x(), pageArea.y(), pageArea.width(), pageArea.height()); -} - -String PrintContext::preferredPageSizeInPixels(Frame* frame, int pageNumber) +String PrintContext::pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) { - IntSize pageSize = frame->document()->preferredPageSizeInPixels(pageNumber); - return String::format("(%d,%d)", pageSize.width(), pageSize.height()); + IntSize pageSize(width, height); + frame->document()->pageSizeAndMarginsInPixels(pageNumber, pageSize, marginTop, marginRight, marginBottom, marginLeft); + return String::format("(%d, %d) %d %d %d %d", pageSize.width(), pageSize.height(), marginTop, marginRight, marginBottom, marginLeft); } int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h index 81a9b76..1080c29 100644 --- a/WebCore/page/PrintContext.h +++ b/WebCore/page/PrintContext.h @@ -57,8 +57,7 @@ public: static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); static String pageProperty(Frame* frame, const char* propertyName, int pageNumber); static bool isPageBoxVisible(Frame* frame, int pageNumber); - static String pageAreaRectInPixels(Frame* frame, int pageNumber); - static String preferredPageSizeInPixels(Frame* frame, int pageNumber); + static String pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft); static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); protected: diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 503b938..d7bba08 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -145,11 +145,16 @@ Settings::Settings(Page* page) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) , m_html5ParserEnabled(true) + , m_html5TreeBuilderEnabled(false) // Will be deleted soon, do not use. , m_paginateDuringLayoutEnabled(false) +<<<<<<< HEAD #ifdef ANDROID_PLUGINS , m_pluginsOnDemand(false) #endif +======= + , m_dnsPrefetchingEnabled(true) +>>>>>>> webkit.org at r62496 { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. @@ -723,6 +728,11 @@ void Settings::setUsesEncodingDetector(bool usesEncodingDetector) m_usesEncodingDetector = usesEncodingDetector; } +void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled) +{ + m_dnsPrefetchingEnabled = dnsPrefetchingEnabled; +} + void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows) { m_allowScriptsToCloseWindows = allowScriptsToCloseWindows; diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 1513a7a..e22fca5 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -180,6 +180,9 @@ namespace WebCore { void setUsesEncodingDetector(bool); bool usesEncodingDetector() const { return m_usesEncodingDetector; } + void setDNSPrefetchingEnabled(bool); + bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; } + void setUserStyleSheetLocation(const KURL&); const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; } @@ -363,6 +366,13 @@ namespace WebCore { void setHTML5ParserEnabled(bool flag) { m_html5ParserEnabled = flag; } bool html5ParserEnabled() const { return m_html5ParserEnabled; } + // NOTE: This code will be deleted once the HTML5TreeBuilder is ready + // to replace LegacyHTMLTreeBuilder. Using the HTML5DocumentParser + // with LegacyHTMLTreeBuilder will not be supported long-term. + // Setting is only for testing the new tree builder in DumpRenderTree. + void setHTML5TreeBuilderEnabled_DO_NOT_USE(bool flag) { m_html5TreeBuilderEnabled = flag; } + bool html5TreeBuilderEnabled() const { return m_html5TreeBuilderEnabled; } + void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; } bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; } @@ -483,11 +493,17 @@ namespace WebCore { bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; bool m_html5ParserEnabled: 1; + bool m_html5TreeBuilderEnabled: 1; // Will be deleted soon, do not use. bool m_paginateDuringLayoutEnabled : 1; +<<<<<<< HEAD #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif +======= + bool m_dnsPrefetchingEnabled : 1; + +>>>>>>> webkit.org at r62496 #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; #endif diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp index 58b70e4..e748d12 100644 --- a/WebCore/page/SpatialNavigation.cpp +++ b/WebCore/page/SpatialNavigation.cpp @@ -546,4 +546,24 @@ bool isScrollableContainerNode(Node* node) return false; } +bool isNodeDeepDescendantOfDocument(Node* node, Document* baseDocument) +{ + if (!node || !baseDocument) + return false; + + bool descendant = baseDocument == node->document(); + + Element* currentElement = static_cast<Element*>(node); + while (!descendant) { + Element* documentOwner = currentElement->document()->ownerElement(); + if (!documentOwner) + break; + + descendant = documentOwner->document() == baseDocument; + currentElement = documentOwner; + } + + return descendant; +} + } // namespace WebCore diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h index 78419a7..d3dcaba 100644 --- a/WebCore/page/SpatialNavigation.h +++ b/WebCore/page/SpatialNavigation.h @@ -133,6 +133,7 @@ void scrollIntoView(Element*); bool hasOffscreenRect(Node*); bool isInRootDocument(Node*); bool isScrollableContainerNode(Node*); +bool isNodeDeepDescendantOfDocument(Node*, Document*); } // namspace WebCore diff --git a/WebCore/page/Timing.cpp b/WebCore/page/Timing.cpp new file mode 100644 index 0000000..dcd0fb7 --- /dev/null +++ b/WebCore/page/Timing.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Timing.h" + +#if ENABLE(WEB_TIMING) + +#include "Frame.h" + +namespace WebCore { + +Timing::Timing(Frame* frame) + : m_frame(frame) +{ +} + +Frame* Timing::frame() const +{ + return m_frame; +} + +void Timing::disconnectFrame() +{ + m_frame = 0; +} + +unsigned long Timing::navigationStart() const +{ + if (!m_frame) + return 0; + + return 0; // FIXME +} + +} // namespace WebCore + +#endif // ENABLE(WEB_TIMING) diff --git a/WebCore/page/Timing.h b/WebCore/page/Timing.h new file mode 100644 index 0000000..7b66d66 --- /dev/null +++ b/WebCore/page/Timing.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Timing_h +#define Timing_h + +#if ENABLE(WEB_TIMING) + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Frame; + +class Timing : public RefCounted<Timing> { +public: + static PassRefPtr<Timing> create(Frame* frame) { return adoptRef(new Timing(frame)); } + + Frame* frame() const; + void disconnectFrame(); + + unsigned long navigationStart() const; + +private: + Timing(Frame*); + + Frame* m_frame; +}; + +} + +#endif // !ENABLE(WEB_TIMING) +#endif // !defined(Timing_h) diff --git a/WebCore/page/Timing.idl b/WebCore/page/Timing.idl new file mode 100644 index 0000000..01b72bc --- /dev/null +++ b/WebCore/page/Timing.idl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module window { + + // See: http://dev.w3.org/2006/webapi/WebTiming/ + interface [Conditional=WEB_TIMING, OmitConstructor] Timing { + readonly attribute unsigned long navigationStart; + // FIXME: Implement remainder of interface. + }; + +} diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index 33a0951..22506b2 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -362,7 +362,11 @@ bool XSSAuditor::findInRequest(Frame* frame, const FindTask& task) const if (task.string.isEmpty()) return false; - FormData* formDataObj = frame->loader()->documentLoader()->originalRequest().httpBody(); + DocumentLoader *documentLoader = frame->loader()->documentLoader(); + if (!documentLoader) + return false; + + FormData* formDataObj = documentLoader->originalRequest().httpBody(); const bool hasFormData = formDataObj && !formDataObj->isEmpty(); String pageURL = frame->document()->url().string(); |