Changeset 44379 in webkit
- Timestamp:
- Jun 2, 2009 10:37:09 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r44378 r44379 1 2009-06-02 Darin Adler <darin@apple.com> 2 3 Reviewed by David Hyatt. 4 5 Bug 26112: viewless WebKit -- make events work 6 https://bugs.webkit.org/show_bug.cgi?id=26112 7 8 The main fix here is to make mouse and wheel event coordinates in the coordinate 9 system of the top level NSView rather than the NSWindow when in the viewless mode. 10 This is the design Hyatt chose, but the event part of it wasn't done yet. 11 12 Also fix FrameView to do normal reference counting instead of a strange model with 13 an explicit deref near creation time. 14 15 * WebCore.base.exp: Updated. 16 17 * page/EventHandler.cpp: 18 (WebCore::EventHandler::eventLoopHandleMouseUp): Moved this function into the file 19 to reduce conditionals in the header. 20 (WebCore::EventHandler::eventLoopHandleMouseDragged): Ditto. 21 22 * page/EventHandler.h: Reduced includes. Fixed formatting of Objective-C types. 23 Made currentNSEvent a static member function. Added sendContextMenuEvent and 24 eventMayStartDrag functions that takes NSEvent * so the conversion to PlatformMouseEvent 25 can be done here rather than in WebKit. Reduced #if by making eventLoopHandleMouseUp and 26 eventLoopHandleMouseDragged unconditional. 27 28 * page/Frame.cpp: 29 (WebCore::Frame::setView): Made this take a PassRefPtr since it takes ownership. 30 (WebCore::Frame::createView): Changed to use RefPtr and FrameView::create and remove 31 the explicit deref. 32 33 * page/Frame.h: Changed setView to take a PassRefPtr. 34 35 * page/FrameTree.cpp: Added newly-needed include. 36 37 * page/FrameView.cpp: 38 (WebCore::FrameView::FrameView): Got rid of one of the two constructors, and removed 39 the initialization of m_refCount and call to show from the reamining one. 40 (WebCore::FrameView::create): Added two create functions that do what the two 41 constructors did before, except that they return a PassRefPtr to make sure the 42 reference counting is handled correctly. 43 (WebCore::FrameView::~FrameView): Removed assertion from when FrameView implemented 44 its own reference counting. 45 46 * page/FrameView.h: Inherit from RefCounted for reference counting. Made the 47 constructor private and added create functions. Got rid of the hand-implemented 48 reference counting in this class. 49 50 * page/mac/EventHandlerMac.mm: 51 (WebCore::currentNSEventSlot): Renamed currentEvent to currentNSEventSlot to 52 make it more clear how it relates to currentNSEvent. 53 (WebCore::EventHandler::currentNSEvent): Updated. 54 (WebCore::CurrentEventScope::CurrentEventScope): Added. Use to set/reset the 55 current event in a foolproof way. 56 (WebCore::CurrentEventScope::~CurrentEventScope): Ditto. 57 (WebCore::EventHandler::wheelEvent): Use CurrentEventScope. Pass the platform 58 window in when constructing the PlatformWheelEvent. 59 (WebCore::EventHandler::keyEvent): Use CurrentEventScope. 60 (WebCore::lastEventIsMouseUp): Use currentNSEvent. 61 (WebCore::EventHandler::passMouseDownEventToWidget): Ditto. 62 (WebCore::EventHandler::eventLoopHandleMouseDragged): Ditto. 63 (WebCore::EventHandler::eventLoopHandleMouseUp): Ditto. 64 (WebCore::EventHandler::passSubframeEventToSubframe): Use 65 currentPlatformMouseEvent to get a mouse event that has the appropriate 66 platform window passed to create it. 67 (WebCore::EventHandler::passWheelEventToWidget): Ditto. 68 (WebCore::EventHandler::mouseDown): Ditto. 69 (WebCore::EventHandler::mouseDragged): Ditto. 70 (WebCore::EventHandler::mouseUp): Ditto. 71 (WebCore::EventHandler::mouseMoved): Ditto. 72 (WebCore::EventHandler::currentPlatformMouseEvent): Added. Passes the 73 platform window that's now needed to create a PlatformMouseEvent. 74 (WebCore::EventHandler::sendContextMenuEvent): Added. 75 (WebCore::EventHandler::eventMayStartDrag): Added. 76 77 * platform/HostWindow.h: Removed unneeded includes and constructor definition. 78 79 * platform/PlatformMouseEvent.h: Sorted things in alphabetical order. 80 Changed Mac constructor to take a windowView as well as the event. This is 81 needed in viewless mode, since the "window" is actually an NSView, so the 82 event has to know which view to compute the coordinates with. Made the 83 same change to pointForEvent. 84 * platform/PlatformWheelEvent.h: Ditto. 85 86 * platform/mac/PlatformMouseEventMac.mm: 87 (WebCore::pointForEvent): Convert point from window coordinates to view 88 coordinates if a windowView is passed in. This is used in viewless mode. 89 (WebCore::PlatformMouseEvent::PlatformMouseEvent): Ditto. 90 * platform/mac/WheelEventMac.mm: 91 (WebCore::PlatformWheelEvent::PlatformWheelEvent): Ditto. 92 93 * platform/mac/WidgetMac.mm: 94 (WebCore::Widget::convertFromContainingWindow): Fixed case where there 95 is no platform widget and no parent. Before it would yield unpredictable 96 results because of dispatching to a nil object and returning a structure. 97 Now it returns the point without changing coordinates at all, which is what 98 we need for this case in viewless mode. 99 100 * rendering/RenderApplet.cpp: Removed unneeded includes. 101 (WebCore::RenderApplet::intrinsicSize): Use widget function. 102 (WebCore::RenderApplet::createWidgetIfNecessary): Ditto. 103 104 * rendering/RenderApplet.h: Make more things private. Get rid of unneeded 105 explicit destructor. 106 107 * rendering/RenderFrame.cpp: Removed unneeded includes. 108 (WebCore::RenderFrame::edgeInfo): Updated to use node function so header 109 doesn't have to define element function. 110 (WebCore::RenderFrame::viewCleared): Ditto. Also changed to use widget 111 function. 112 113 * rendering/RenderFrame.h: Removed unneeded includes. Made some things 114 private. Got rid of element function. 115 116 * rendering/RenderPart.cpp: Removed unneeded includes. 117 (WebCore::RenderPart::~RenderPart): Changed to use clearWidget function. 118 (WebCore::RenderPart::setWidget): Changed to use widget function. 119 (WebCore::RenderPart::deleteWidget): Changed to use passed-in widget. 120 This is now only called by the clearWidget function. 121 122 * rendering/RenderPart.h: Removed unneeded forward declarations. 123 Made more functions private. Updated deleteWidget to take widget argument. 124 125 * rendering/RenderPartObject.cpp: 126 (WebCore::RenderPartObject::~RenderPartObject): use frameView function 127 instead of getting at m_view directly. 128 (WebCore::RenderPartObject::updateWidget): Ditto. 129 (WebCore::RenderPartObject::layout): Ditto. Same for widget and m_widget. 130 (WebCore::RenderPartObject::viewCleared): Ditto. 131 132 * rendering/RenderPartObject.h: Made some functions private. 133 134 * rendering/RenderWidget.cpp: 135 (WebCore::RenderWidget::RenderWidget): Initialize m_frameView with 136 construction syntax instead of assignment. 137 (WebCore::RenderWidget::destroy): Updated for name change of m_view 138 to m_frameView. 139 (WebCore::RenderWidget::~RenderWidget): Use clearWidget to delete 140 the widget. 141 (WebCore::RenderWidget::setWidget): Use clearWidget. 142 (WebCore::RenderWidget::paint): Updated for name change of m_view 143 to m_frameView. 144 (WebCore::RenderWidget::deleteWidget): Changed to use passed-in widget. 145 146 * rendering/RenderWidget.h: Made many functions protected, others 147 private and made all data members private. 148 149 * svg/animation/SMILTime.h: Removed unhelpful max and min functions. These 150 just do what std::max and std::min will already do automatically for this 151 type, so they are not helpful. 152 153 * svg/graphics/SVGImage.cpp: 154 (WebCore::SVGImage::SVGImage): Removed unneeded initial values for types 155 that initialize to zero without anything explicit. 156 (WebCore::SVGImage::~SVGImage): Update since m_frame and m_frameView are 157 no longer stored. 158 (WebCore::SVGImage::setContainerSize): Ditto. 159 (WebCore::SVGImage::usesContainerSize): Ditto. 160 (WebCore::SVGImage::size): Ditto. 161 (WebCore::SVGImage::hasRelativeWidth): Ditto. 162 (WebCore::SVGImage::hasRelativeHeight): Ditto. 163 (WebCore::SVGImage::draw): Ditto. 164 (WebCore::SVGImage::nativeImageForCurrentFrame): Ditto. 165 (WebCore::SVGImage::dataChanged): Ditto. 166 167 * svg/graphics/SVGImage.h: Removed unneeded includes and unneeded data 168 members m_document, m_frame, m_frameView, and m_minSize. 169 1 170 2009-06-02 Adam Langley <agl@google.com> 2 171 -
trunk/WebCore/WebCore.base.exp
r44322 r44379 233 233 __ZN7WebCore12EventHandler17dragSourceEndedAtERKNS_18PlatformMouseEventENS_13DragOperationE 234 234 __ZN7WebCore12EventHandler17dragSourceMovedToERKNS_18PlatformMouseEventE 235 __ZN7WebCore12EventHandler17eventMayStartDragEP7NSEvent 235 236 __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb 236 237 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbb 237 __ZN7WebCore12EventHandler20sendContextMenuEventE RKNS_18PlatformMouseEventE238 __ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent 238 239 __ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv 239 240 __ZN7WebCore12EventHandler7mouseUpEP7NSEvent … … 396 397 __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv 397 398 __ZN7WebCore17equalIgnoringCaseEPNS_10StringImplES1_ 398 __ZN7WebCore18PlatformMouseEventC1EP7NSEvent399 399 __ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE 400 400 __ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKNS_6StringEd … … 520 520 __ZN7WebCore5Frame4initEv 521 521 __ZN7WebCore5Frame6scriptEv 522 __ZN7WebCore5Frame7setViewE PNS_9FrameViewE522 __ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE 523 523 __ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE 524 524 __ZN7WebCore5FrameD1Ev … … 684 684 __ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb 685 685 __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb 686 __ZN7WebCore9FrameView C1EPNS_5FrameE687 __ZN7WebCore9FrameView C1EPNS_5FrameERKNS_7IntSizeE686 __ZN7WebCore9FrameView6createEPNS_5FrameE 687 __ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE 688 688 __ZN7WebCore9HTMLNames10listingTagE 689 689 __ZN7WebCore9HTMLNames11textareaTagE … … 774 774 __ZNK7WebCore11HistoryItem9urlStringEv 775 775 __ZNK7WebCore11HistoryItem9viewStateEv 776 __ZNK7WebCore12EventHandler17eventMayStartDragERKNS_18PlatformMouseEventE777 776 __ZNK7WebCore12EventHandler20currentKeyboardEventEv 778 777 __ZNK7WebCore12IconDatabase12databasePathEv -
trunk/WebCore/page/EventHandler.cpp
r44371 r44379 118 118 e.accept(); 119 119 } 120 121 #if !PLATFORM(MAC) 122 123 inline bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) 124 { 125 return false; 126 } 127 128 inline bool EventHandler::eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&) 129 { 130 return false; 131 } 132 133 #endif 120 134 121 135 EventHandler::EventHandler(Frame* frame) -
trunk/WebCore/page/EventHandler.h
r42725 r44379 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "DragActions.h" 30 #include "FocusDirection.h"31 30 #include "PlatformMouseEvent.h" 32 31 #include "ScrollTypes.h" 33 32 #include "Timer.h" 34 33 #include <wtf/Forward.h> 35 #include <wtf/Noncopyable.h>36 #include <wtf/Platform.h>37 34 #include <wtf/RefPtr.h> 38 35 39 #if PLATFORM(MAC) 40 #include "WebCoreKeyboardUIMode.h" 41 #ifndef __OBJC__ 42 class NSEvent; 36 #if PLATFORM(MAC) && !defined(__OBJC__) 43 37 class NSView; 44 #endif45 38 #endif 46 39 … … 52 45 class Event; 53 46 class FloatPoint; 54 class FloatRect;55 47 class Frame; 56 48 class HitTestRequest; … … 69 61 class SVGElementInstance; 70 62 class TextEvent; 71 class VisiblePosition;72 63 class Widget; 73 64 … … 160 151 void sendScrollEvent(); 161 152 162 #if PLATFORM(MAC) 153 #if PLATFORM(MAC) && defined(__OBJC__) 163 154 PassRefPtr<KeyboardEvent> currentKeyboardEvent() const; 164 155 165 void mouseDown(NSEvent*); 166 void mouseDragged(NSEvent*); 167 void mouseUp(NSEvent*); 168 void mouseMoved(NSEvent*); 169 bool keyEvent(NSEvent*); 170 bool wheelEvent(NSEvent*); 171 172 void sendFakeEventsAfterWidgetTracking(NSEvent* initiatingEvent); 156 void mouseDown(NSEvent *); 157 void mouseDragged(NSEvent *); 158 void mouseUp(NSEvent *); 159 void mouseMoved(NSEvent *); 160 bool keyEvent(NSEvent *); 161 bool wheelEvent(NSEvent *); 162 163 bool sendContextMenuEvent(NSEvent *); 164 bool eventMayStartDrag(NSEvent *); 165 166 void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent); 173 167 174 168 void setActivationEventNumber(int num) { m_activationEventNumber = num; } 175 169 176 NSEvent *currentNSEvent();170 static NSEvent *currentNSEvent(); 177 171 #endif 178 172 … … 194 188 195 189 bool eventActivatedView(const PlatformMouseEvent&) const; 196 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& event);197 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults& event);190 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); 191 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&); 198 192 199 193 bool handleMouseDoubleClickEvent(const PlatformMouseEvent&); … … 267 261 // The following are called at the beginning of handleMouseUp and handleDrag. 268 262 // If they return true it indicates that they have consumed the event. 269 #if PLATFORM(MAC)270 263 bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&); 271 264 bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&); 265 266 bool invertSenseOfTabsToLinks(KeyboardEvent*) const; 267 268 void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint); 269 270 bool capturesDragging() const { return m_capturesDragging; } 271 272 #if PLATFORM(MAC) && defined(__OBJC__) 272 273 NSView *mouseDownViewIfStillGood(); 273 #else 274 bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) { return false; } 275 bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&) { return false; } 276 #endif 277 278 bool invertSenseOfTabsToLinks(KeyboardEvent*) const; 279 280 void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint); 281 282 bool capturesDragging() const { return m_capturesDragging; } 274 275 PlatformMouseEvent currentPlatformMouseEvent() const; 276 #endif 283 277 284 278 Frame* m_frame; … … 305 299 bool m_mouseDownMayStartAutoscroll; 306 300 bool m_mouseDownWasInSubframe; 301 307 302 #if ENABLE(SVG) 308 303 bool m_svgPan; … … 339 334 int m_activationEventNumber; 340 335 #endif 341 342 336 }; 343 337 -
trunk/WebCore/page/Frame.cpp
r44215 r44379 222 222 } 223 223 224 void Frame::setView( FrameView*view)224 void Frame::setView(PassRefPtr<FrameView> view) 225 225 { 226 226 // Detach the document now, so any onUnload handlers get run - if … … 1752 1752 setView(0); 1753 1753 1754 FrameView*frameView;1754 RefPtr<FrameView> frameView; 1755 1755 if (isMainFrame) { 1756 frameView = new FrameView(this, viewportSize);1756 frameView = FrameView::create(this, viewportSize); 1757 1757 frameView->setFixedLayoutSize(fixedLayoutSize); 1758 1758 frameView->setUseFixedLayout(useFixedLayout); 1759 1759 } else 1760 frameView = new FrameView(this);1760 frameView = FrameView::create(this); 1761 1761 1762 1762 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode); … … 1764 1764 1765 1765 setView(frameView); 1766 // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.1767 frameView->deref();1768 1766 1769 1767 if (backgroundColor.isValid()) … … 1774 1772 1775 1773 if (ownerRenderer()) 1776 ownerRenderer()->setWidget(frameView );1774 ownerRenderer()->setWidget(frameView.get()); 1777 1775 1778 1776 if (HTMLFrameOwnerElement* owner = ownerElement()) -
trunk/WebCore/page/Frame.h
r42725 r44379 6 6 * 2000-2001 Dirk Mueller <mueller@kde.org> 7 7 * 2000 Stefan Schimanski <1Stein@gmx.de> 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 9 9 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 10 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> … … 92 92 return adoptRef(new Frame(page, ownerElement, client)); 93 93 } 94 void setView( FrameView*);94 void setView(PassRefPtr<FrameView>); 95 95 ~Frame(); 96 96 -
trunk/WebCore/page/FrameTree.cpp
r40870 r44379 22 22 23 23 #include "Frame.h" 24 #include "FrameView.h" 24 25 #include "Page.h" 25 26 #include "PageGroup.h" -
trunk/WebCore/page/FrameView.cpp
r44311 r44379 91 91 92 92 FrameView::FrameView(Frame* frame) 93 : m_refCount(1) 94 , m_frame(frame) 93 : m_frame(frame) 95 94 , m_vmode(ScrollbarAuto) 96 95 , m_hmode(ScrollbarAuto) … … 115 114 { 116 115 init(); 117 show(); 118 } 119 120 FrameView::FrameView(Frame* frame, const IntSize& initialSize) 121 : m_refCount(1) 122 , m_frame(frame) 123 , m_vmode(ScrollbarAuto) 124 , m_hmode(ScrollbarAuto) 125 , m_slowRepaintObjectCount(0) 126 , m_layoutTimer(this, &FrameView::layoutTimerFired) 127 , m_layoutRoot(0) 128 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 129 , m_needToInitScrollbars(true) 130 , m_isTransparent(false) 131 , m_baseBackgroundColor(Color::white) 132 , m_mediaType("screen") 133 , m_enqueueEvents(0) 134 , m_overflowStatusDirty(true) 135 , m_viewportRenderer(0) 136 , m_wasScrolledByUser(false) 137 , m_inProgrammaticScroll(false) 138 , m_deferredRepaintTimer(this, &FrameView::deferredRepaintTimerFired) 139 , m_shouldUpdateWhileOffscreen(true) 140 , m_deferSetNeedsLayouts(0) 141 , m_setNeedsLayoutWasDeferred(false) 142 , m_lockedToAnchor(false) 143 { 144 init(); 145 Widget::setFrameRect(IntRect(x(), y(), initialSize.width(), initialSize.height())); 146 show(); 116 } 117 118 PassRefPtr<FrameView> FrameView::create(Frame* frame) 119 { 120 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 121 view->show(); 122 return view.release(); 123 } 124 125 PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize) 126 { 127 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 128 view->Widget::setFrameRect(IntRect(view->pos(), initialSize)); 129 view->show(); 130 return view.release(); 147 131 } 148 132 … … 159 143 setHasVerticalScrollbar(false); 160 144 161 ASSERT(m_refCount == 0);162 145 ASSERT(m_scheduledEvents.isEmpty()); 163 146 ASSERT(!m_enqueueEvents); -
trunk/WebCore/page/FrameView.h
r44311 r44379 49 49 template <typename T> class Timer; 50 50 51 class FrameView : public ScrollView {51 class FrameView : public ScrollView, public RefCounted<FrameView> { 52 52 public: 53 53 friend class RenderView; 54 54 55 FrameView(Frame*);56 FrameView(Frame*, const IntSize& initialSize);55 static PassRefPtr<FrameView> create(Frame*); 56 static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize); 57 57 58 58 virtual ~FrameView(); … … 64 64 Frame* frame() const { return m_frame.get(); } 65 65 void clearFrame(); 66 67 void ref() { ++m_refCount; }68 void deref() { if (!--m_refCount) delete this; }69 bool hasOneRef() { return m_refCount == 1; }70 66 71 67 int marginWidth() const { return m_margins.width(); } // -1 means default … … 194 190 195 191 private: 192 FrameView(Frame*); 193 196 194 void reset(); 197 195 void init(); … … 226 224 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache 227 225 228 unsigned m_refCount;229 226 IntSize m_size; 230 227 IntSize m_margins; -
trunk/WebCore/page/mac/EventHandlerMac.mm
r43111 r44379 1 1 /* 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 62 62 const double EventHandler::TextDragDelay = 0.15; 63 63 64 static RetainPtr<NSEvent>& current Event()64 static RetainPtr<NSEvent>& currentNSEventSlot() 65 65 { 66 66 DEFINE_STATIC_LOCAL(RetainPtr<NSEvent>, event, ()); … … 70 70 NSEvent *EventHandler::currentNSEvent() 71 71 { 72 return currentEvent().get(); 72 return currentNSEventSlot().get(); 73 } 74 75 class CurrentEventScope : Noncopyable { 76 public: 77 CurrentEventScope(NSEvent *); 78 ~CurrentEventScope(); 79 80 private: 81 RetainPtr<NSEvent> m_savedCurrentEvent; 82 #ifndef NDEBUG 83 RetainPtr<NSEvent> m_event; 84 #endif 85 }; 86 87 inline CurrentEventScope::CurrentEventScope(NSEvent *event) 88 : m_savedCurrentEvent(currentNSEventSlot()) 89 #ifndef NDEBUG 90 , m_event(event) 91 #endif 92 { 93 currentNSEventSlot() = event; 94 } 95 96 inline CurrentEventScope::~CurrentEventScope() 97 { 98 ASSERT(currentNSEventSlot() == m_event); 99 currentNSEventSlot() = m_savedCurrentEvent; 73 100 } 74 101 75 102 bool EventHandler::wheelEvent(NSEvent *event) 76 103 { 77 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 78 currentEvent() = event; 79 80 PlatformWheelEvent wheelEvent(event); 104 Page* page = m_frame->page(); 105 if (!page) 106 return false; 107 108 CurrentEventScope scope(event); 109 110 PlatformWheelEvent wheelEvent(event, page->chrome()->platformWindow()); 81 111 handleWheelEvent(wheelEvent); 82 83 ASSERT(currentEvent() == event);84 currentEvent() = oldCurrentEvent;85 112 86 113 return wheelEvent.isAccepted(); … … 166 193 bool EventHandler::keyEvent(NSEvent *event) 167 194 { 168 bool result;169 195 BEGIN_BLOCK_OBJC_EXCEPTIONS; 170 196 171 197 ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp); 172 198 173 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 174 currentEvent() = event; 175 176 result = keyEvent(PlatformKeyboardEvent(event)); 177 178 ASSERT(currentEvent() == event); 179 currentEvent() = oldCurrentEvent; 180 181 return result; 199 CurrentEventScope scope(event); 200 return keyEvent(PlatformKeyboardEvent(event)); 182 201 183 202 END_BLOCK_OBJC_EXCEPTIONS; … … 221 240 static bool lastEventIsMouseUp() 222 241 { 223 // Many AK widgets run their own event loops and consume events while the mouse is down. 224 // When they finish, currentEvent is the mouseUp that they exited on. We need to update 225 // the khtml state with this mouseUp, which khtml never saw. This method lets us detect 226 // that state. 242 // Many AppKit widgets run their own event loops and consume events while the mouse is down. 243 // When they finish, currentEvent is the mouseUp that they exited on. We need to update 244 // the WebCore state with this mouseUp, which we never saw. This method lets us detect 245 // that state. Handling this was critical when we used AppKit widgets for form elements. 246 // It's not clear in what cases this is helpful now -- it's possible it can be removed. 227 247 228 248 BEGIN_BLOCK_OBJC_EXCEPTIONS; 229 249 NSEvent *currentEventAfterHandlingMouseDown = [NSApp currentEvent]; 230 if (currentEvent() != currentEventAfterHandlingMouseDown && 231 [currentEventAfterHandlingMouseDown type] == NSLeftMouseUp && 232 [currentEventAfterHandlingMouseDown timestamp] >= [currentEvent().get() timestamp]) 233 return true; 250 return EventHandler::currentNSEvent() != currentEventAfterHandlingMouseDown 251 && [currentEventAfterHandlingMouseDown type] == NSLeftMouseUp 252 && [currentEventAfterHandlingMouseDown timestamp] >= [EventHandler::currentNSEvent() timestamp]; 234 253 END_BLOCK_OBJC_EXCEPTIONS; 235 254 … … 239 258 bool EventHandler::passMouseDownEventToWidget(Widget* widget) 240 259 { 241 // FIXME: this method always returns true 260 // FIXME: This function always returns true. It should be changed either to return 261 // false in some cases or the return value should be removed. 242 262 243 263 if (!widget) { … … 251 271 ASSERT(nodeView); 252 272 ASSERT([nodeView superview]); 253 NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[current Event().get() locationInWindow] fromView:nil]];273 NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentNSEvent() locationInWindow] fromView:nil]]; 254 274 if (!view) { 255 275 // We probably hit the border of a RenderWidget … … 264 284 // Normally [NSWindow sendEvent:] handles setting the first responder. 265 285 // But in our case, the event was sent to the view representing the entire web page. 266 if ([current Event().get() clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey])286 if ([currentNSEvent() clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey]) 267 287 page->chrome()->client()->makeFirstResponder(view); 268 288 } … … 281 301 ASSERT(!m_sendingEventToSubview); 282 302 m_sendingEventToSubview = true; 283 [view mouseDown:current Event().get()];303 [view mouseDown:currentNSEvent()]; 284 304 m_sendingEventToSubview = false; 285 305 … … 356 376 m_sendingEventToSubview = true; 357 377 BEGIN_BLOCK_OBJC_EXCEPTIONS; 358 [view mouseDragged:current Event().get()];378 [view mouseDragged:currentNSEvent()]; 359 379 END_BLOCK_OBJC_EXCEPTIONS; 360 380 m_sendingEventToSubview = false; … … 383 403 m_sendingEventToSubview = true; 384 404 BEGIN_BLOCK_OBJC_EXCEPTIONS; 385 [view mouseUp:current Event().get()];405 [view mouseUp:currentNSEvent()]; 386 406 END_BLOCK_OBJC_EXCEPTIONS; 387 407 m_sendingEventToSubview = false; … … 395 415 BEGIN_BLOCK_OBJC_EXCEPTIONS; 396 416 397 switch ([current Event().get() type]) {417 switch ([currentNSEvent() type]) { 398 418 case NSLeftMouseDragged: 399 419 case NSOtherMouseDragged: … … 406 426 return false; 407 427 case NSMouseMoved: 408 // Since we're passing in current Event() here, we can call428 // Since we're passing in currentNSEvent() here, we can call 409 429 // handleMouseMoveEvent() directly, since the save/restore of 410 // current Event() that mouseMoved() does would have no effect.430 // currentNSEvent() that mouseMoved() does would have no effect. 411 431 ASSERT(!m_sendingEventToSubview); 412 432 m_sendingEventToSubview = true; 413 subframe->eventHandler()->handleMouseMoveEvent(current Event().get(), hoveredNode);433 subframe->eventHandler()->handleMouseMoveEvent(currentPlatformMouseEvent(), hoveredNode); 414 434 m_sendingEventToSubview = false; 415 435 return true; … … 435 455 ASSERT(!m_sendingEventToSubview); 436 456 m_sendingEventToSubview = true; 437 subframe->eventHandler()->handleMouseReleaseEvent(current Event().get());457 subframe->eventHandler()->handleMouseReleaseEvent(currentPlatformMouseEvent()); 438 458 m_sendingEventToSubview = false; 439 459 return true; … … 485 505 BEGIN_BLOCK_OBJC_EXCEPTIONS; 486 506 487 if ([current Event().get() type] != NSScrollWheel || m_sendingEventToSubview || !widget)507 if ([currentNSEvent() type] != NSScrollWheel || m_sendingEventToSubview || !widget) 488 508 return false; 489 509 … … 491 511 ASSERT(nodeView); 492 512 ASSERT([nodeView superview]); 493 NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[current Event().get() locationInWindow] fromView:nil]];513 NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentNSEvent() locationInWindow] fromView:nil]]; 494 514 if (!view) 495 515 // We probably hit the border of a RenderWidget … … 502 522 // in the nested tracking runloop that -[NSScrollView scrollWheel:] runs. 503 523 setNSScrollViewScrollWheelShouldRetainSelf(true); 504 [view scrollWheel:current Event().get()];524 [view scrollWheel:currentNSEvent()]; 505 525 setNSScrollViewScrollWheelShouldRetainSelf(false); 506 526 m_sendingEventToSubview = false; … … 523 543 m_mouseDownView = nil; 524 544 525 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 526 currentEvent() = event; 527 m_mouseDown = PlatformMouseEvent(event); 528 529 handleMousePressEvent(event); 530 531 ASSERT(currentEvent() == event); 532 currentEvent() = oldCurrentEvent; 545 CurrentEventScope scope(event); 546 m_mouseDown = currentPlatformMouseEvent(); 547 handleMousePressEvent(m_mouseDown); 533 548 534 549 END_BLOCK_OBJC_EXCEPTIONS; … … 543 558 BEGIN_BLOCK_OBJC_EXCEPTIONS; 544 559 545 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 546 currentEvent() = event; 547 548 handleMouseMoveEvent(event); 549 550 ASSERT(currentEvent() == event); 551 currentEvent() = oldCurrentEvent; 560 CurrentEventScope scope(event); 561 handleMouseMoveEvent(currentPlatformMouseEvent()); 552 562 553 563 END_BLOCK_OBJC_EXCEPTIONS; … … 562 572 BEGIN_BLOCK_OBJC_EXCEPTIONS; 563 573 564 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 565 currentEvent() = event; 574 CurrentEventScope scope(event); 566 575 567 576 // Our behavior here is a little different that Qt. Qt always sends … … 574 583 int clickCount = [event clickCount]; 575 584 if (clickCount > 0 && clickCount % 2 == 0) 576 handleMouseDoubleClickEvent( event);585 handleMouseDoubleClickEvent(currentPlatformMouseEvent()); 577 586 else 578 handleMouseReleaseEvent(event); 579 580 ASSERT(currentEvent() == event); 581 currentEvent() = oldCurrentEvent; 587 handleMouseReleaseEvent(currentPlatformMouseEvent()); 582 588 583 589 m_mouseDownView = nil; … … 658 664 659 665 BEGIN_BLOCK_OBJC_EXCEPTIONS; 660 661 RetainPtr<NSEvent> oldCurrentEvent = currentEvent(); 662 currentEvent() = event; 663 664 mouseMoved(PlatformMouseEvent(event)); 665 666 ASSERT(currentEvent() == event); 667 currentEvent() = oldCurrentEvent; 668 666 CurrentEventScope scope(event); 667 mouseMoved(currentPlatformMouseEvent()); 669 668 END_BLOCK_OBJC_EXCEPTIONS; 670 669 } … … 696 695 } 697 696 698 } 697 PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const 698 { 699 NSView *windowView = nil; 700 if (Page* page = m_frame->page()) 701 windowView = page->chrome()->platformWindow(); 702 return PlatformMouseEvent(currentNSEvent(), windowView); 703 } 704 705 bool EventHandler::sendContextMenuEvent(NSEvent *event) 706 { 707 Page* page = m_frame->page(); 708 if (!page) 709 return false; 710 return sendContextMenuEvent(PlatformMouseEvent(event, page->chrome()->platformWindow())); 711 } 712 713 bool EventHandler::eventMayStartDrag(NSEvent *event) 714 { 715 Page* page = m_frame->page(); 716 if (!page) 717 return false; 718 return eventMayStartDrag(PlatformMouseEvent(event, page->chrome()->platformWindow())); 719 } 720 721 } -
trunk/WebCore/platform/HostWindow.h
r39717 r44379 28 28 29 29 #include <wtf/Noncopyable.h> 30 #include "IntRect.h"31 30 #include "Widget.h" 32 31 33 32 namespace WebCore { 34 33 35 class IntPoint;36 class IntRect;37 38 34 class HostWindow : Noncopyable { 39 35 public: 40 HostWindow() {} 41 virtual ~HostWindow() {} 36 virtual ~HostWindow() { } 42 37 43 38 // The repaint method asks the host window to repaint a rect in the window's coordinate space. The -
trunk/WebCore/platform/PlatformMouseEvent.h
r44060 r44379 1 1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "IntPoint.h" 30 #include <wtf/Platform.h>31 32 #if PLATFORM(MAC)33 #ifdef __OBJC__34 @class NSEvent;35 @class NSScreen;36 @class NSWindow;37 #else38 class NSEvent;39 class NSScreen;40 class NSWindow;41 #endif42 #endif43 44 #if PLATFORM(WIN)45 typedef struct HWND__* HWND;46 typedef unsigned UINT;47 typedef unsigned WPARAM;48 typedef long LPARAM;49 #endif50 30 51 31 #if PLATFORM(GTK) … … 58 38 class QInputEvent; 59 39 QT_END_NAMESPACE 40 #endif 41 42 #if PLATFORM(WIN) 43 typedef struct HWND__* HWND; 44 typedef unsigned UINT; 45 typedef unsigned WPARAM; 46 typedef long LPARAM; 60 47 #endif 61 48 … … 85 72 } 86 73 87 PlatformMouseEvent(const IntPoint& pos , const IntPoint& globalPos, MouseButton button, MouseEventType eventType,74 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, MouseEventType eventType, 88 75 int clickCount, bool shift, bool ctrl, bool alt, bool meta, double timestamp) 89 : m_position(pos), m_globalPosition(globalPos), m_button(button) 76 : m_position(position) 77 , m_globalPosition(globalPosition) 78 , m_button(button) 90 79 , m_eventType(eventType) 91 80 , m_clickCount(clickCount) … … 113 102 unsigned modifierFlags() const { return m_modifierFlags; } 114 103 115 // time in seconds104 // Time in seconds. 116 105 double timestamp() const { return m_timestamp; } 117 106 118 #if PLATFORM(MAC) 119 PlatformMouseEvent(NSEvent*); 107 #if PLATFORM(GTK) 108 PlatformMouseEvent(GdkEventButton*); 109 PlatformMouseEvent(GdkEventMotion*); 110 #endif 111 112 #if PLATFORM(MAC) && defined(__OBJC__) 113 PlatformMouseEvent(NSEvent *, NSView *windowView); 120 114 int eventNumber() const { return m_eventNumber; } 121 115 #endif 116 117 #if PLATFORM(QT) 118 PlatformMouseEvent(QInputEvent*, int clickCount); 119 #endif 120 122 121 #if PLATFORM(WIN) 123 122 PlatformMouseEvent(HWND, UINT, WPARAM, LPARAM, bool activatedWebView = false); 124 123 void setClickCount(int count) { m_clickCount = count; } 125 124 bool activatedWebView() const { return m_activatedWebView; } 126 #endif127 #if PLATFORM(GTK)128 PlatformMouseEvent(GdkEventButton*);129 PlatformMouseEvent(GdkEventMotion*);130 #endif131 #if PLATFORM(QT)132 PlatformMouseEvent(QInputEvent*, int clickCount);133 125 #endif 134 126 … … 137 129 #endif 138 130 139 140 protected: 131 private: 141 132 IntPoint m_position; 142 133 IntPoint m_globalPosition; … … 150 141 double m_timestamp; // unit: seconds 151 142 unsigned m_modifierFlags; 143 152 144 #if PLATFORM(MAC) 153 145 int m_eventNumber; 154 146 #endif 147 155 148 #if PLATFORM(WIN) 156 149 bool m_activatedWebView; … … 158 151 }; 159 152 160 #if PLATFORM(MAC) 161 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow * window);162 IntPoint pointForEvent(NSEvent * event);163 IntPoint globalPointForEvent(NSEvent * event);153 #if PLATFORM(MAC) && defined(__OBJC__) 154 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *); 155 IntPoint pointForEvent(NSEvent *, NSView *windowView); 156 IntPoint globalPointForEvent(NSEvent *); 164 157 #endif 165 158 -
trunk/WebCore/platform/PlatformWheelEvent.h
r41746 r44379 1 1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "IntPoint.h" 30 30 31 #if PLATFORM(MAC)32 #ifdef __OBJC__33 @class NSEvent;34 #else35 class NSEvent;36 #endif37 #endif38 39 #if PLATFORM(WIN)40 typedef struct HWND__* HWND;41 typedef unsigned WPARAM;42 typedef long LPARAM;43 #endif44 45 31 #if PLATFORM(GTK) 46 32 typedef struct _GdkEventScroll GdkEventScroll; … … 51 37 class QWheelEvent; 52 38 QT_END_NAMESPACE 39 #endif 40 41 #if PLATFORM(WIN) 42 typedef struct HWND__* HWND; 43 typedef unsigned WPARAM; 44 typedef long LPARAM; 53 45 #endif 54 46 … … 94 86 void ignore() { m_isAccepted = false; } 95 87 96 #if PLATFORM( MAC)97 PlatformWheelEvent( NSEvent*);88 #if PLATFORM(GTK) 89 PlatformWheelEvent(GdkEventScroll*); 98 90 #endif 91 92 #if PLATFORM(MAC) && defined(__OBJC__) 93 PlatformWheelEvent(NSEvent *, NSView *windowView); 94 #endif 95 96 #if PLATFORM(QT) 97 PlatformWheelEvent(QWheelEvent*); 98 #endif 99 99 100 #if PLATFORM(WIN) 100 101 PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isMouseHWheel); 101 102 #endif 102 #if PLATFORM(GTK) 103 PlatformWheelEvent(GdkEventScroll*); 104 #endif 105 #if PLATFORM(QT) 106 PlatformWheelEvent(QWheelEvent*); 107 #endif 103 108 104 #if PLATFORM(WX) 109 105 PlatformWheelEvent(const wxMouseEvent&, const wxPoint&); 110 106 #endif 111 107 112 pr otected:108 private: 113 109 IntPoint m_position; 114 110 IntPoint m_globalPosition; -
trunk/WebCore/platform/mac/PlatformMouseEventMac.mm
r40171 r44379 69 69 } 70 70 71 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)71 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window) 72 72 { 73 73 return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window))); 74 74 } 75 75 76 IntPoint pointForEvent(NSEvent *event )76 IntPoint pointForEvent(NSEvent *event, NSView *windowView) 77 77 { 78 78 switch ([event type]) { … … 87 87 case NSOtherMouseDragged: 88 88 case NSMouseMoved: 89 case NSScrollWheel: 90 // Note: This has its origin at the bottom left of the window. 91 // The Y coordinate gets flipped by ScrollView::viewportToContents. 92 // We should probably change both this and that to not use "bottom left origin" coordinates at all. 93 return IntPoint([event locationInWindow]); 89 case NSScrollWheel: { 90 // Note: This will have its origin at the bottom left of the window unless windowView is flipped. 91 // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow. 92 NSPoint location = [event locationInWindow]; 93 if (windowView) 94 location = [windowView convertPoint:location fromView:nil]; 95 return IntPoint(location); 96 } 94 97 default: 95 98 return IntPoint(); … … 140 143 } 141 144 142 PlatformMouseEvent::PlatformMouseEvent(NSEvent* event )143 : m_position(pointForEvent(event ))145 PlatformMouseEvent::PlatformMouseEvent(NSEvent* event, NSView *windowView) 146 : m_position(pointForEvent(event, windowView)) 144 147 , m_globalPosition(globalPointForEvent(event)) 145 148 , m_button(mouseButtonForEvent(event)) -
trunk/WebCore/platform/mac/WheelEventMac.mm
r41746 r44379 33 33 namespace WebCore { 34 34 35 PlatformWheelEvent::PlatformWheelEvent(NSEvent* event )36 : m_position(pointForEvent(event ))35 PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView) 36 : m_position(pointForEvent(event, windowView)) 37 37 , m_globalPosition(globalPointForEvent(event)) 38 38 , m_granularity(ScrollByPixelWheelEvent) -
trunk/WebCore/platform/mac/WidgetMac.mm
r40558 r44379 286 286 IntPoint Widget::convertFromContainingWindow(const IntPoint& point) const 287 287 { 288 if (!platformWidget() && parent()) { 288 if (!platformWidget()) { 289 if (!parent()) 290 return point; 289 291 IntPoint result = parent()->convertFromContainingWindow(point); 290 292 result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); … … 301 303 IntRect Widget::convertFromContainingWindow(const IntRect& rect) const 302 304 { 303 if (!platformWidget() && parent()) { 305 if (!platformWidget()) { 306 if (!parent()) 307 return rect; 304 308 IntRect result = parent()->convertFromContainingWindow(rect); 305 309 result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); -
trunk/WebCore/rendering/RenderApplet.cpp
r40107 r44379 1 /** 2 * This file is part of the HTML widget for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 * Copyright (C) 2003, 2006 Apple Computer, Inc.3 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 25 23 #include "RenderApplet.h" 26 24 27 #include "Document.h"28 25 #include "Frame.h" 29 #include "FrameLoader.h"30 26 #include "HTMLAppletElement.h" 31 27 #include "HTMLNames.h" 32 28 #include "HTMLParamElement.h" 33 #include "Widget.h"34 29 35 30 namespace WebCore { … … 44 39 } 45 40 46 RenderApplet::~RenderApplet()47 {48 }49 50 41 IntSize RenderApplet::intrinsicSize() const 51 42 { … … 54 45 // layout and sizing to be correct. We should remove this and 55 46 // pass the appropriate intrinsic size in the constructor. 56 return m_widget? IntSize(50, 50) : IntSize(150, 150);47 return widget() ? IntSize(50, 50) : IntSize(150, 150); 57 48 } 58 49 … … 60 51 { 61 52 HTMLAppletElement* element = static_cast<HTMLAppletElement*>(node()); 62 if ( m_widget|| !element->isFinishedParsingChildren())53 if (widget() || !element->isFinishedParsingChildren()) 63 54 return; 64 55 -
trunk/WebCore/rendering/RenderApplet.h
r25754 r44379 1 1 /* 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 33 33 public: 34 34 RenderApplet(HTMLAppletElement*, const HashMap<String, String>& args); 35 virtual ~RenderApplet();36 35 36 void createWidgetIfNecessary(); 37 38 private: 37 39 virtual const char* renderName() const { return "RenderApplet"; } 38 40 … … 42 44 virtual IntSize intrinsicSize() const; 43 45 44 void createWidgetIfNecessary();45 46 private:47 46 HashMap<String, String> m_args; 48 47 }; -
trunk/WebCore/rendering/RenderFrame.cpp
r25754 r44379 1 /** 2 * This file is part of the KDE project. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 7 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 26 24 #include "config.h" 27 25 #include "RenderFrame.h" 28 #include "RenderFrameSet.h" 26 29 27 #include "FrameView.h" 30 #include "HTMLFrameSetElement.h" 31 #include "HTMLNames.h" 28 #include "HTMLFrameElement.h" 32 29 33 30 namespace WebCore { 34 35 using namespace HTMLNames;36 31 37 32 RenderFrame::RenderFrame(HTMLFrameElement* frame) … … 43 38 FrameEdgeInfo RenderFrame::edgeInfo() const 44 39 { 45 return FrameEdgeInfo(element()->noResize(), element()->hasFrameBorder()); 40 HTMLFrameElement* element = static_cast<HTMLFrameElement*>(node()); 41 return FrameEdgeInfo(element->noResize(), element->hasFrameBorder()); 46 42 } 47 43 48 44 void RenderFrame::viewCleared() 49 45 { 50 if (element() && m_widget && m_widget->isFrameView()) { 51 FrameView* view = static_cast<FrameView*>(m_widget); 52 int marginw = element()->getMarginWidth(); 53 int marginh = element()->getMarginHeight(); 46 HTMLFrameElement* element = static_cast<HTMLFrameElement*>(node()); 47 if (!element || !widget() || !widget()->isFrameView()) 48 return; 54 49 55 if (marginw != -1) 56 view->setMarginWidth(marginw); 57 if (marginh != -1) 58 view->setMarginHeight(marginh); 59 } 50 FrameView* view = static_cast<FrameView*>(widget()); 51 52 int marginw = element->getMarginWidth(); 53 int marginh = element->getMarginHeight(); 54 55 if (marginw != -1) 56 view->setMarginWidth(marginw); 57 if (marginh != -1) 58 view->setMarginHeight(marginh); 60 59 } 61 60 -
trunk/WebCore/rendering/RenderFrame.h
r40871 r44379 1 1 /* 2 * This file is part of the KDE project.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 * Copyright (C) 2006 Apple Computer, Inc.4 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 26 24 #define RenderFrame_h 27 25 28 #include "HTMLFrameElement.h"29 26 #include "RenderPart.h" 30 27 #include "RenderFrameSet.h" … … 32 29 namespace WebCore { 33 30 31 class HTMLFrameElement; 32 34 33 class RenderFrame : public RenderPart { 35 34 public: 36 35 RenderFrame(HTMLFrameElement*); 37 36 37 FrameEdgeInfo edgeInfo() const; 38 39 private: 38 40 virtual const char* renderName() const { return "RenderFrame"; } 39 41 virtual bool isFrame() const { return true; } 40 41 HTMLFrameElement* element() const { return static_cast<HTMLFrameElement*>(RenderPart::node()); }42 43 FrameEdgeInfo edgeInfo() const;44 42 45 43 virtual void viewCleared(); -
trunk/WebCore/rendering/RenderPart.cpp
r41042 r44379 1 /** 2 * This file is part of the KDE project. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 7 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 23 21 * 24 22 */ 23 25 24 #include "config.h" 26 25 #include "RenderPart.h" 27 26 28 #include "Document.h"29 27 #include "Frame.h" 30 #include "FrameTree.h"31 28 #include "FrameView.h" 32 #include "HTMLFrameOwnerElement.h"33 #include "HTMLNames.h"34 #include "Page.h"35 29 36 30 namespace WebCore { 37 38 using namespace HTMLNames;39 31 40 32 RenderPart::RenderPart(Element* node) … … 47 39 RenderPart::~RenderPart() 48 40 { 41 clearWidget(); 42 } 43 44 void RenderPart::setWidget(Widget* widget) 45 { 46 if (widget == this->widget()) 47 return; 48 49 if (widget && widget->isFrameView()) 50 static_cast<FrameView*>(widget)->ref(); 51 RenderWidget::setWidget(widget); 52 53 // make sure the scrollbars are set correctly for restore 54 // ### find better fix 55 viewCleared(); 56 } 57 58 void RenderPart::viewCleared() 59 { 60 } 61 62 void RenderPart::deleteWidget(Widget* widget) 63 { 49 64 // Since deref ends up calling setWidget back on us, need to make sure 50 65 // that widget is already 0 so it won't do any work. 51 Widget* widget = m_widget;52 m_widget = 0; 66 ASSERT(!this->widget()); 67 53 68 if (widget && widget->isFrameView()) 54 69 static_cast<FrameView*>(widget)->deref(); … … 57 72 } 58 73 59 void RenderPart::setWidget(Widget* widget)60 {61 if (widget != m_widget) {62 if (widget && widget->isFrameView())63 static_cast<FrameView*>(widget)->ref();64 RenderWidget::setWidget(widget);65 66 // make sure the scrollbars are set correctly for restore67 // ### find better fix68 viewCleared();69 }70 74 } 71 72 void RenderPart::viewCleared()73 {74 }75 76 void RenderPart::deleteWidget()77 {78 if (m_widget && m_widget->isFrameView())79 static_cast<FrameView*>(m_widget)->deref();80 else81 delete m_widget;82 }83 84 } -
trunk/WebCore/rendering/RenderPart.h
r41042 r44379 1 1 /* 2 * This file is part of the KDE project.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 * Copyright (C) 2006 Apple Computer, Inc.4 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 30 28 namespace WebCore { 31 29 32 class Frame;33 class HTMLFrameOwnerElement;34 35 30 class RenderPart : public RenderWidget { 36 31 public: … … 38 33 virtual ~RenderPart(); 39 34 40 virtual bool isRenderPart() const { return true; } 41 virtual const char* renderName() const { return "RenderPart"; } 35 bool hasFallbackContent() const { return m_hasFallbackContent; } 42 36 43 37 virtual void setWidget(Widget*); 44 45 bool hasFallbackContent() const { return m_hasFallbackContent; }46 47 38 virtual void viewCleared(); 48 39 … … 51 42 52 43 private: 53 virtual void deleteWidget(); 44 virtual bool isRenderPart() const { return true; } 45 virtual const char* renderName() const { return "RenderPart"; } 46 47 virtual void deleteWidget(Widget*); 54 48 }; 55 49 -
trunk/WebCore/rendering/RenderPartObject.cpp
r42107 r44379 3 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 26 26 27 27 #include "Frame.h" 28 #include "FrameLoader.h"29 28 #include "FrameLoaderClient.h" 30 #include "FrameTree.h"31 #include "FrameView.h"32 29 #include "HTMLEmbedElement.h" 33 30 #include "HTMLIFrameElement.h" … … 35 32 #include "HTMLObjectElement.h" 36 33 #include "HTMLParamElement.h" 37 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)38 #include "HTMLMediaElement.h"39 #include "HTMLVideoElement.h"40 #endif41 34 #include "MIMETypeRegistry.h" 42 35 #include "Page.h" … … 44 37 #include "RenderView.h" 45 38 #include "Text.h" 39 40 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 41 #include "HTMLVideoElement.h" 42 #endif 46 43 47 44 namespace WebCore { … … 62 59 RenderPartObject::~RenderPartObject() 63 60 { 64 if ( m_view)65 m_view->removeWidgetToUpdate(this);61 if (frameView()) 62 frameView()->removeWidgetToUpdate(this); 66 63 } 67 64 … … 152 149 Vector<String> paramNames; 153 150 Vector<String> paramValues; 154 Frame* frame = m_view->frame();151 Frame* frame = frameView()->frame(); 155 152 156 153 if (node()->hasTagName(objectTag)) { … … 338 335 RenderPart::layout(); 339 336 340 if (! m_widget && m_view)341 m_view->addWidgetToUpdate(this);337 if (!widget() && frameView()) 338 frameView()->addWidgetToUpdate(this); 342 339 343 340 setNeedsLayout(false); … … 346 343 void RenderPartObject::viewCleared() 347 344 { 348 if (node() && m_widget && m_widget->isFrameView()) {349 FrameView* view = static_cast<FrameView*>( m_widget);345 if (node() && widget() && widget()->isFrameView()) { 346 FrameView* view = static_cast<FrameView*>(widget()); 350 347 int marginw = -1; 351 348 int marginh = -1; -
trunk/WebCore/rendering/RenderPartObject.h
r41042 r44379 1 1 /* 2 * This file is part of the KDE project.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 * Copyright (C) 2006 Apple Computer,Inc.4 * Copyright (C) 2006, 2009 Apple Inc. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 35 33 virtual ~RenderPartObject(); 36 34 35 void updateWidget(bool onlyCreateNonNetscapePlugins); 36 37 private: 37 38 virtual const char* renderName() const { return "RenderPartObject"; } 38 39 39 40 virtual void layout(); 40 void updateWidget(bool onlyCreateNonNetscapePlugins);41 41 42 42 virtual void viewCleared(); -
trunk/WebCore/rendering/RenderWidget.cpp
r44235 r44379 1 /** 2 * This file is part of the HTML widget for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 6 * Copyright (C) 2004, 2006 Apple Computer, Inc.4 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 28 26 #include "AnimationController.h" 29 27 #include "AXObjectCache.h" 30 #include "Document.h"31 #include "Element.h"32 #include "Event.h"33 #include "FrameView.h"34 28 #include "GraphicsContext.h" 35 29 #include "HitTestResult.h" 36 #include "RenderLayer.h"37 30 #include "RenderView.h" 38 31 … … 48 41 49 42 RenderWidget::RenderWidget(Node* node) 50 : RenderReplaced(node) 51 , m_widget(0) 52 , m_refCount(0) 53 { 54 // a replaced element doesn't support being anonymous 55 ASSERT(node); 56 m_view = node->document()->view(); 57 43 : RenderReplaced(node) 44 , m_widget(0) 45 , m_frameView(node->document()->view()) 46 , m_refCount(0) 47 { 58 48 view()->addWidget(this); 59 49 … … 83 73 84 74 if (m_widget) { 85 if (m_ view)86 m_ view->removeChild(m_widget);75 if (m_frameView) 76 m_frameView->removeChild(m_widget); 87 77 widgetRendererMap().remove(m_widget); 88 78 } … … 111 101 { 112 102 ASSERT(m_refCount <= 0); 113 deleteWidget();103 clearWidget(); 114 104 } 115 105 … … 130 120 m_widget->removeFromParent(); 131 121 widgetRendererMap().remove(m_widget); 132 deleteWidget();122 clearWidget(); 133 123 } 134 124 m_widget = widget; … … 146 136 m_widget->show(); 147 137 } 148 m_ view->addChild(m_widget);138 m_frameView->addChild(m_widget); 149 139 } 150 140 } … … 185 175 } 186 176 187 if (!m_ view || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)177 if (!m_frameView || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE) 188 178 return; 189 179 … … 285 275 } 286 276 287 void RenderWidget::deleteWidget() 288 { 289 delete m_widget; 277 void RenderWidget::clearWidget() 278 { 279 Widget* widget = m_widget; 280 m_widget = 0; 281 if (widget) 282 deleteWidget(widget); 283 } 284 285 void RenderWidget::deleteWidget(Widget* widget) 286 { 287 delete widget; 290 288 } 291 289 -
trunk/WebCore/rendering/RenderWidget.h
r42849 r44379 1 1 /* 2 * This file is part of the HTML widget for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.3 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 34 32 class RenderWidget : public RenderReplaced, private OverlapTestRequestClient { 35 33 public: 36 RenderWidget(Node*);37 34 virtual ~RenderWidget(); 38 35 36 Widget* widget() const { return m_widget; } 37 virtual void setWidget(Widget*); 38 39 static RenderWidget* find(const Widget*); 40 41 void updateWidgetPosition(); 42 43 protected: 44 RenderWidget(Node*); 45 46 FrameView* frameView() const { return m_frameView; } 47 48 void clearWidget(); 49 50 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 51 virtual void layout(); 52 53 private: 39 54 virtual bool isWidget() const { return true; } 40 55 41 virtual void paint(PaintInfo&, int tx, int ty); 56 virtual void paint(PaintInfo&, int x, int y); 57 virtual void destroy(); 58 virtual void setSelectionState(SelectionState); 59 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 60 virtual void deleteWidget(Widget*); 61 virtual void setOverlapTestResult(bool); 42 62 43 virtual void destroy(); 44 virtual void layout(); 45 46 Widget* widget() const { return m_widget; } 47 static RenderWidget* find(const Widget*); 63 void setWidgetGeometry(const IntRect&); 48 64 49 65 RenderArena* ref() { ++m_refCount; return renderArena(); } 50 66 void deref(RenderArena*); 51 67 52 virtual void setSelectionState(SelectionState);53 54 void updateWidgetPosition();55 56 virtual void setWidget(Widget*);57 58 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);59 60 protected:61 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);62 63 private:64 void setWidgetGeometry(const IntRect&);65 66 virtual void deleteWidget();67 68 // OverlapTestRequestClient69 virtual void setOverlapTestResult(bool);70 71 protected:72 68 Widget* m_widget; 73 FrameView* m_view; 74 75 private: 69 FrameView* m_frameView; 76 70 int m_refCount; 77 71 }; -
trunk/WebCore/svg/animation/SMILTime.h
r31808 r44379 63 63 inline bool operator<=(const SMILTime& a, const SMILTime& b) { return a.value() < b.value() || operator==(a, b); } 64 64 65 inline SMILTime max(const SMILTime& a, const SMILTime& b) { return std::max(a.value(), b.value()); }66 inline SMILTime min(const SMILTime& a, const SMILTime& b) { return std::min(a.value(), b.value()); }67 65 SMILTime operator+(const SMILTime&, const SMILTime&); 68 66 SMILTime operator-(const SMILTime&, const SMILTime&); -
trunk/WebCore/svg/graphics/SVGImage.cpp
r44096 r44379 1 1 /* 2 2 * Copyright (C) 2006 Eric Seidel (eric@webkit.org) 3 * Copyright (C) 2008 Apple,Inc. All rights reserved.3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "CachedPage.h" 32 32 #include "DocumentLoader.h" 33 #include "EmptyClients.h" 33 34 #include "FloatRect.h" 34 35 #include "Frame.h" … … 37 38 #include "GraphicsContext.h" 38 39 #include "HTMLFormElement.h" 40 #include "ImageBuffer.h" 39 41 #include "ImageObserver.h" 40 42 #include "Page.h" … … 47 49 #include "Settings.h" 48 50 49 #include "EmptyClients.h"50 51 51 namespace WebCore { 52 52 … … 77 77 SVGImage::SVGImage(ImageObserver* observer) 78 78 : Image(observer) 79 , m_document(0)80 , m_chromeClient(0)81 , m_page(0)82 , m_frame(0)83 , m_frameView(0)84 79 { 85 80 } … … 87 82 SVGImage::~SVGImage() 88 83 { 89 if (m_frame) 90 m_frame->loader()->frameDetached(); // Break both the loader and view references to the frame 91 92 // Clear these manually so we can safely delete the ChromeClient afterwards 93 m_frameView.clear(); 94 m_frame.clear(); 95 m_page.clear(); 96 84 if (m_page) { 85 m_page->mainFrame()->loader()->frameDetached(); // Break both the loader and view references to the frame 86 87 // Clear explicitly because we want to delete the page before the ChromeClient. 88 // FIXME: I believe that's already guaranteed by C++ object destruction rules, 89 // so this may matter only for the assertion below. 90 m_page.clear(); 91 } 92 97 93 // Verify that page teardown destroyed the Chrome 98 94 ASSERT(!m_chromeClient->image()); … … 101 97 void SVGImage::setContainerSize(const IntSize& containerSize) 102 98 { 103 if (containerSize.width() <= 0 || containerSize.height() <= 0) 104 return; 105 106 if (!m_frame) 107 return; 108 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); 99 if (containerSize.isEmpty()) 100 return; 101 102 if (!m_page) 103 return; 104 Frame* frame = m_page->mainFrame(); 105 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 109 106 if (!rootElement) 110 107 return; … … 115 112 bool SVGImage::usesContainerSize() const 116 113 { 117 if (!m_frame) 118 return false; 119 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); 114 if (!m_page) 115 return false; 116 Frame* frame = m_page->mainFrame(); 117 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 120 118 if (!rootElement) 121 119 return false; … … 126 124 IntSize SVGImage::size() const 127 125 { 128 if (!m_ frame)126 if (!m_page) 129 127 return IntSize(); 130 131 SVGSVGElement* rootElement = static_cast<SVGDocument*>( m_frame->document())->rootElement();128 Frame* frame = m_page->mainFrame(); 129 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 132 130 if (!rootElement) 133 131 return IntSize(); … … 152 150 bool SVGImage::hasRelativeWidth() const 153 151 { 154 if (!m_ frame)155 return false; 156 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_ frame->document())->rootElement();152 if (!m_page) 153 return false; 154 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); 157 155 if (!rootElement) 158 156 return false; … … 163 161 bool SVGImage::hasRelativeHeight() const 164 162 { 165 if (!m_ frame)166 return false; 167 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_ frame->document())->rootElement();163 if (!m_page) 164 return false; 165 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); 168 166 if (!rootElement) 169 167 return false; … … 174 172 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) 175 173 { 176 if (!m_frame) 177 return; 178 174 if (!m_page) 175 return; 176 177 FrameView* view = m_page->mainFrame()->view(); 178 179 179 context->save(); 180 180 context->setCompositeOperation(compositeOp); 181 181 context->clip(enclosingIntRect(dstRect)); 182 182 if (compositeOp != CompositeSourceOver) 183 context->beginTransparencyLayer(1 .0f);183 context->beginTransparencyLayer(1); 184 184 context->translate(dstRect.location().x(), dstRect.location().y()); 185 context->scale(FloatSize(dstRect.width() /srcRect.width(), dstRect.height()/srcRect.height()));186 187 m_frame->view()->resize(size());188 189 if ( m_frame->view()->needsLayout())190 m_frame->view()->layout();191 m_frame->view()->paint(context, enclosingIntRect(srcRect));185 context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); 186 187 view->resize(size()); 188 189 if (view->needsLayout()) 190 view->layout(); 191 view->paint(context, enclosingIntRect(srcRect)); 192 192 193 193 if (compositeOp != CompositeSourceOver) … … 206 206 // having a tiled drawing callback (hopefully non-virtual). 207 207 if (!m_frameCache) { 208 if (!m_page) 209 return 0; 208 210 m_frameCache = ImageBuffer::create(size(), false); 209 211 if (!m_frameCache) // failed to allocate image 210 212 return 0; 211 renderSubtreeToImage(m_frameCache.get(), m_ frame->contentRenderer());213 renderSubtreeToImage(m_frameCache.get(), m_page->mainFrame()->contentRenderer()); 212 214 } 213 215 return m_frameCache->image()->nativeImageForCurrentFrame(); … … 216 218 bool SVGImage::dataChanged(bool allDataReceived) 217 219 { 218 int length = m_data->size();219 if (! length) // if this was an empty image220 // Don't do anything if is an empty image. 221 if (!m_data->size()) 220 222 return true; 221 223 222 224 if (allDataReceived) { 223 225 static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient; … … 229 231 m_chromeClient.set(new SVGImageChromeClient(this)); 230 232 231 // FIXME: If this SVG ends up loading itself, we'll leak this Frame (and associated DOM & render trees). 232 // The Cache code does not know about CachedImages holding Frames and won't know to break the cycle. 233 // FIXME: If this SVG ends up loading itself, we might leak the world. 234 // THe comment said that the Cache code does not know about CachedImages 235 // holding Frames and won't know to break the cycle. But 233 236 m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient)); 234 237 m_page->settings()->setJavaScriptEnabled(false); 235 238 m_page->settings()->setPluginsEnabled(false); 236 239 237 m_frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); 238 m_frameView = new FrameView(m_frame.get()); 239 m_frameView->deref(); // FIXME: FrameView starts with a refcount of 1 240 m_frame->setView(m_frameView.get()); 241 m_frame->init(); 240 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); 241 frame->setView(FrameView::create(frame.get())); 242 frame->init(); 242 243 ResourceRequest fakeRequest(KURL("")); 243 m_frame->loader()->load(fakeRequest, false); // Make sure the DocumentLoader is created 244 m_frame->loader()->cancelContentPolicyCheck(); // cancel any policy checks 245 m_frame->loader()->commitProvisionalLoad(0); 246 m_frame->loader()->setResponseMIMEType("image/svg+xml"); 247 m_frame->loader()->begin(KURL()); // create the empty document 248 m_frame->loader()->write(m_data->data(), m_data->size()); 249 m_frame->loader()->end(); 250 m_frameView->setTransparent(true); // SVG Images are transparent. 251 } 252 return m_frameView; 244 FrameLoader* loader = frame->loader(); 245 loader->load(fakeRequest, false); // Make sure the DocumentLoader is created 246 loader->cancelContentPolicyCheck(); // cancel any policy checks 247 loader->commitProvisionalLoad(0); 248 loader->setResponseMIMEType("image/svg+xml"); 249 loader->begin(KURL()); // create the empty document 250 loader->write(m_data->data(), m_data->size()); 251 loader->end(); 252 frame->view()->setTransparent(true); // SVG Images are transparent. 253 } 254 255 return m_page; 253 256 } 254 257 -
trunk/WebCore/svg/graphics/SVGImage.h
r39601 r44379 1 1 /* 2 2 * Copyright (C) 2006 Eric Seidel (eric@webkit.org) 3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 30 31 31 32 #include "Image.h" 32 #include "ImageBuffer.h"33 #include "IntSize.h"34 #include <wtf/OwnPtr.h>35 33 36 34 namespace WebCore { 37 38 class SVGDocument; 39 class Frame; 40 class FrameView; 35 36 class ImageBuffer; 41 37 class Page; 42 38 class SVGImageChromeClient; … … 73 69 virtual NativeImagePtr nativeImageForCurrentFrame(); 74 70 75 SVGDocument* m_document;76 71 OwnPtr<SVGImageChromeClient> m_chromeClient; 77 72 OwnPtr<Page> m_page; 78 RefPtr<Frame> m_frame;79 RefPtr<FrameView> m_frameView;80 IntSize m_minSize;81 73 OwnPtr<ImageBuffer> m_frameCache; 82 74 }; -
trunk/WebKit/mac/ChangeLog
r44376 r44379 1 2009-06-02 Darin Adler <darin@apple.com> 2 3 Reviewed by David Hyatt. 4 5 Bug 26112: viewless WebKit -- make events work 6 https://bugs.webkit.org/show_bug.cgi?id=26112 7 8 One change here is to make the -[WebFrame frameView] function assert if ever called 9 in viewless mode, and fix many callers that would trip that assertion. 10 11 A major change is to put some methods and data in WebView that are currently in 12 WebHTMLView, used only in viewless mode. A next step will be to use the WebView 13 methods whenever possible, even when not in the viewless mode. 14 15 Also fix FrameView to do normal reference counting instead of a strange model with 16 an explicit deref near creation time. 17 18 * WebCoreSupport/WebChromeClient.mm: 19 (WebChromeClient::scrollRectIntoView): Add code to start in the appropriate place 20 when dealing with viewless mode. This gets triggered when visiting the Google home page. 21 (WebChromeClient::setToolTip): Changed to call WebView instead of WebHTMLView. 22 (WebChromeClient::print): Changed to use a new selector that doesn't require a 23 WebFrameView if present. Also don't even try to use the old selector in viewless mode. 24 25 * WebCoreSupport/WebEditorClient.mm: 26 (WebEditorClient::respondToChangedSelection): Changed to call WebView instead of WebHTMLView. 27 28 * WebCoreSupport/WebFrameLoaderClient.mm: 29 (WebFrameLoaderClient::transitionToCommittedForNewPage): Added more code paths for 30 viewless mode to skip things we can't do in that mode, with appropriate FIXME. 31 Use Frame::create and RefPtr and eliminate the strange reference counting of FrameView. 32 33 * WebView/WebDataSource.mm: 34 (-[WebDataSource _receivedData:]): Added a _usesDocumentViews guard around code that's 35 specific to document views. 36 37 * WebView/WebFrame.mm: 38 (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]): Added a _usesDocumentViews 39 guard around code that's specific to document views. 40 (-[WebFrame _hasSelection]): Added an implementation for viewless mode. 41 (-[WebFrame _clearSelection]): Assert we're not in viewless mode; it doesn't really 42 make sense to clear the selection in only one frame in viewless mode. Later we can 43 decide what to do. 44 (-[WebFrame _dragSourceMovedTo:]): Assert we're not in viewless mode; the dragging 45 code for viewless mode shouldn't have to involve the WebFrame object at all. 46 (-[WebFrame _dragSourceEndedAt:operation:]): Ditto. 47 (-[WebFrame frameView]): Assert we're not in viewless mode. This assertion fires 48 often, but it's a great pointer to code that needs to be changed. 49 50 * WebView/WebHTMLView.mm: 51 (-[WebHTMLView hitTest:]): Tweaked a comment. 52 (-[WebHTMLView _updateMouseoverWithEvent:]): Fixed a bug where the fake event for 53 moving the mouse out of the old view ended up overwriting the event for moving 54 the mouse within the new view. 55 (-[WebHTMLView mouseDown:]): Got rid of explicit conversion of event to 56 PlatformMouseEvent in call to sendContextMenuEvent; that's no longer possible 57 without passing another argument, and it's now handled in EventHandler. 58 59 * WebView/WebTextCompletionController.h: Copied from WebKit/mac/WebView/WebHTMLView.mm. 60 Removed everything except for the WebTextCompletionController class. 61 * WebView/WebTextCompletionController.mm: Copied from WebKit/mac/WebView/WebHTMLView.mm. 62 Ditto. 63 64 * WebView/WebUIDelegatePrivate.h: Added webView:printFrame: method. 65 66 * WebView/WebView.mm: Moved includes and fields in from WebHTMLView. 67 (-[WebView _usesDocumentViews]): Updated for name change from useDocumentViews 68 to usesDocumentViews. 69 (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): Ditto. 70 (-[WebView drawSingleRect:]): Ditto. 71 (-[WebView isFlipped]): Ditto. 72 (-[WebView setFrameSize:]): Ditto. Also changed to use _mainCoreFrame method. 73 (-[WebView _viewWillDrawInternal]): Ditto. 74 (-[WebView viewWillDraw]): Ditto. 75 (-[WebView drawRect:]): Ditto. 76 (-[WebView _close]): Added code to nil out the lastMouseoverView global. 77 (-[WebView _dashboardRegions]): Use _mainCoreFrame. 78 (-[WebView setProhibitsMainFrameScrolling:]): Ditto. 79 (-[WebView _setInViewSourceMode:]): Ditto. 80 (-[WebView _inViewSourceMode]): Ditto. 81 (-[WebView _attachScriptDebuggerToAllFrames]): Ditto. 82 (-[WebView _detachScriptDebuggerFromAllFrames]): Ditto. 83 (-[WebView textIteratorForRect:]): Ditto. 84 (-[WebView _executeCoreCommandByName:value:]): Ditto. 85 (-[WebView addWindowObserversForWindow:]): Ditto. 86 (-[WebView removeWindowObservers]): Ditto. 87 (-[WebView _updateFocusedAndActiveState]): Ditto. 88 (-[WebView _updateFocusedAndActiveStateForFrame:]): Turned into a class method. 89 Added code to handle the viewless case without calling frameView. 90 (-[WebView _windowDidBecomeKey:]): Updated for name change from useDocumentViews 91 to usesDocumentViews. 92 (-[WebView _windowDidResignKey:]): Ditto. 93 (-[WebView _windowWillOrderOnScreen:]): Ditto. 94 (-[WebView mainFrame]): Tweaked. 95 (-[WebView selectedFrame]): Added a conditional to avoid trying to get at the 96 frame view in viewless case. 97 (-[WebView _setZoomMultiplier:isTextOnly:]): Use _mainCoreFrame. 98 (-[WebView setCustomTextEncodingName:]): Ditto. 99 (-[WebView windowScriptObject]): Ditto. 100 (-[WebView setHostWindow:]): Ditto. Also put some code that's needed only for 101 document views inside _private->usesDocumentViews. 102 (-[WebView _hitTest:dragTypes:]): Tweaked. 103 (-[WebView acceptsFirstResponder]): Added case for viewless mode along with a 104 FIXME, since it's not complete. 105 (-[WebView becomeFirstResponder]): Ditto. 106 (-[WebView _webcore_effectiveFirstResponder]): Put the body of this inside 107 a usesDocumentView check, because we don't need the first responder forwarding 108 in viewless mode. 109 (-[WebView setNextKeyView:]): Ditto. 110 (-[WebView mouseDown:]): Added. Copied from WebHTMLView. FIXME in here suggests 111 that we make WebHTMLView share this one soon, which I think is practical. 112 (-[WebView mouseUp:]): Ditto. 113 (-[WebView setHoverFeedbackSuspended:]): Added a code path for viewless mode. 114 (-[WebView shouldClose]): Use _mainCoreFrame. 115 (-[WebView aeDescByEvaluatingJavaScriptFromString:]): Ditto. 116 (-[WebView setEditable:]): Ditto. 117 (-[WebView _frameViewAtWindowPoint:]): Added an assertion that we're not in 118 viewless mode since this method makes no sense in that mode. 119 (-[WebView _setMouseDownEvent:]): Added. Copied from WebHTMLView. I plan to 120 eliminate the one in WebHTMLView soon. 121 (-[WebView _cancelUpdateMouseoverTimer]): Ditto. 122 (-[WebView _stopAutoscrollTimer]): Ditto. 123 (+[WebView _updateMouseoverWithEvent:]): Ditto. 124 (-[WebView _updateMouseoverWithFakeEvent]): Ditto. 125 (-[WebView _setToolTip:]): Added. Calls through to the WebHTMLView version. 126 (-[WebView _selectionChanged]): Ditto. 127 (-[WebView _mainCoreFrame]): Added. 128 (-[WebView _needsOneShotDrawingSynchronization]): Moved into the WebInternal 129 category. 130 (-[WebView _setNeedsOneShotDrawingSynchronization:]): Ditto. 131 (-[WebView _startedAcceleratedCompositingForFrame:]): Ditto. 132 (-[WebView _stoppedAcceleratedCompositingForFrame:]): Ditto. 133 (viewUpdateRunLoopObserverCallBack): Ditto. 134 (-[WebView _scheduleViewUpdate]): Ditto. 135 136 * WebView/WebViewInternal.h: Made most of the file not compile at all when 137 included from non-C++ source files, elminating some excess declarations and 138 typedefs. Moved more methods into the real internal category. Added new 139 methods _setMouseDownEvent, _cancelUpdateMouseoverTimer, _stopAutoscrollTimer, 140 _updateMouseoverWithFakeEvent, _selectionChanged, and _setToolTip:. 141 1 142 2009-06-02 Mark Rowe <mrowe@apple.com> 2 143 -
trunk/WebKit/mac/WebCoreSupport/WebChromeClient.mm
r44136 r44379 478 478 // we just do ourselves). 479 479 480 // We have to convert back to document view coordinates in order to let the flipping conversion take place. It just481 // doesn't make sense for the scrollRectIntoView API to take document view coordinates.482 480 IntRect scrollRect = r; 483 scrollRect.move(scrollView->scrollOffset()); 481 NSView *startView = m_webView; 482 if ([m_webView _usesDocumentViews]) { 483 // We have to convert back to document view coordinates. 484 // It doesn't make sense for the scrollRectIntoView API to take document view coordinates. 485 scrollRect.move(scrollView->scrollOffset()); 486 startView = [[[m_webView mainFrame] frameView] documentView]; 487 } 484 488 NSRect rect = scrollRect; 485 for (NSView *view = [[[m_webView mainFrame] frameView] documentView]; view; view = [view superview]) {489 for (NSView *view = startView; view; view = [view superview]) { 486 490 if ([view isKindOfClass:[NSClipView class]]) { 487 491 NSClipView *clipView = (NSClipView *)view; 488 492 NSView *documentView = [clipView documentView]; 489 [documentView scrollRectToVisible:[documentView convertRect:rect fromView: [[[m_webView mainFrame] frameView] documentView]]];493 [documentView scrollRectToVisible:[documentView convertRect:rect fromView:startView]]; 490 494 } 491 495 } … … 503 507 void WebChromeClient::setToolTip(const String& toolTip) 504 508 { 505 [ (WebHTMLView *)[[[m_webView mainFrame] frameView] documentView]_setToolTip:toolTip];509 [m_webView _setToolTip:toolTip]; 506 510 } 507 511 508 512 void WebChromeClient::print(Frame* frame) 509 513 { 510 WebFrameView* frameView = [kit(frame) frameView]; 511 CallUIDelegate(m_webView, @selector(webView:printFrameView:), frameView); 514 WebFrame *webFrame = kit(frame); 515 if ([[m_webView UIDelegate] respondsToSelector:@selector(webView:printFrame:)]) 516 CallUIDelegate(m_webView, @selector(webView:printFrame:), webFrame); 517 else if ([m_webView _usesDocumentViews]) 518 CallUIDelegate(m_webView, @selector(webView:printFrameView:), [webFrame frameView]); 512 519 } 513 520 … … 650 657 651 658 #if USE(ACCELERATED_COMPOSITING) 659 652 660 void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) 653 661 { 654 662 BEGIN_BLOCK_OBJC_EXCEPTIONS; 655 663 WebFrameView *frameView = [kit(frame) frameView]; 656 WebHTMLView *doc View = (WebHTMLView *)[frameView documentView];664 WebHTMLView *documentView = (WebHTMLView *)[frameView documentView]; 657 665 if (graphicsLayer) 658 [doc View attachRootLayer:graphicsLayer->nativeLayer()];666 [documentView attachRootLayer:graphicsLayer->nativeLayer()]; 659 667 else 660 [doc View detachRootLayer];668 [documentView detachRootLayer]; 661 669 END_BLOCK_OBJC_EXCEPTIONS; 662 670 } … … 675 683 END_BLOCK_OBJC_EXCEPTIONS; 676 684 } 685 677 686 #endif 678 687 -
trunk/WebKit/mac/WebCoreSupport/WebEditorClient.mm
r43984 r44379 281 281 void WebEditorClient::respondToChangedSelection() 282 282 { 283 NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView]; 284 if ([view isKindOfClass:[WebHTMLView class]]) 285 [(WebHTMLView *)view _selectionChanged]; 283 [m_webView _selectionChanged]; 286 284 287 285 // FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r44136 r44379 1038 1038 void WebFrameLoaderClient::transitionToCommittedForNewPage() 1039 1039 { 1040 WebFrameView *v = m_webFrame->_private->webFrameView; 1041 WebDataSource *ds = [m_webFrame.get() _dataSource]; 1042 1043 bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[ds _responseMIMEType]] == [WebHTMLView class]; 1044 bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView; 1045 if (canSkipCreation) { 1046 [[v documentView] setDataSource:ds]; 1047 return; 1048 } 1049 1050 // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view. 1051 if (!willProduceHTMLView) 1052 [[v _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO]; 1040 WebView *webView = getWebView(m_webFrame.get()); 1041 WebDataSource *dataSource = [m_webFrame.get() _dataSource]; 1042 bool usesDocumentViews = [webView _usesDocumentViews]; 1043 1044 if (usesDocumentViews) { 1045 // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too. 1046 bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class]; 1047 bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView; 1048 if (canSkipCreation) { 1049 [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource]; 1050 return; 1051 } 1052 1053 // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view. 1054 if (!willProduceHTMLView) 1055 [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO]; 1056 } 1053 1057 1054 1058 // clean up webkit plugin instances before WebHTMLView gets freed. 1055 WebView *webView = getWebView(m_webFrame.get());1056 1059 [webView removePluginInstanceViewsFor:(m_webFrame.get())]; 1057 1060 1058 BOOL useDocumentViews = [webView _usesDocumentViews];1059 1061 NSView <WebDocumentView> *documentView = nil; 1060 if (use DocumentViews) {1061 documentView = [ v _makeDocumentViewForDataSource:ds];1062 if (usesDocumentViews) { 1063 documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource]; 1062 1064 if (!documentView) 1063 1065 return; … … 1073 1075 coreFrame->view()->setParentVisible(false); 1074 1076 coreFrame->setView(0); 1075 FrameView*coreView;1076 if (use DocumentViews)1077 coreView = new FrameView(coreFrame);1077 RefPtr<FrameView> coreView; 1078 if (usesDocumentViews) 1079 coreView = FrameView::create(coreFrame); 1078 1080 else 1079 coreView = new FrameView(coreFrame, IntSize([webView bounds].size));1081 coreView = FrameView::create(coreFrame, IntSize([webView bounds].size)); 1080 1082 coreFrame->setView(coreView); 1081 coreView->deref(); // FIXME: Eliminate this crazy refcounting!1082 1083 1083 1084 [m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen]; 1084 1085 1085 [v _install]; 1086 if (usesDocumentViews) 1087 [m_webFrame->_private->webFrameView _install]; 1086 1088 1087 1089 if (isMainFrame) 1088 1090 coreView->setParentVisible(true); 1089 1091 1090 // Call setDataSource on the document view after it has been placed in the view hierarchy. 1091 // This what we for the top-level view, so should do this for views in subframes as well. 1092 [documentView setDataSource:ds]; 1092 if (usesDocumentViews) { 1093 // Call setDataSource on the document view after it has been placed in the view hierarchy. 1094 // This what we for the top-level view, so should do this for views in subframes as well. 1095 [documentView setDataSource:dataSource]; 1096 } 1093 1097 1094 1098 if (HTMLFrameOwnerElement* owner = coreFrame->ownerElement()) 1095 1099 coreFrame->view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff); 1096 1097 1100 } 1098 1101 -
trunk/WebKit/mac/WebView/WebDataSource.mm
r41299 r44379 225 225 226 226 [[self representation] receivedData:data withDataSource:self]; 227 [[[[self webFrame] frameView] documentView] dataSourceUpdated:self]; 227 228 if ([[self _webView] _usesDocumentViews]) 229 [[[[self webFrame] frameView] documentView] dataSourceUpdated:self]; 228 230 } 229 231 -
trunk/WebKit/mac/WebView/WebFrame.mm
r43187 r44379 319 319 Frame* coreFrame = _private->coreFrame; 320 320 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 321 WebFrame *webFrame = kit(frame); 322 // Don't call setDrawsBackground:YES here because it may be NO because of a load 323 // in progress; WebFrameLoaderClient keeps it set to NO during the load process. 324 if (!drawsBackground) 325 [[[webFrame frameView] _scrollView] setDrawsBackground:NO]; 326 [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor]; 327 id documentView = [[webFrame frameView] documentView]; 328 if ([documentView respondsToSelector:@selector(setDrawsBackground:)]) 329 [documentView setDrawsBackground:drawsBackground]; 330 if ([documentView respondsToSelector:@selector(setBackgroundColor:)]) 331 [documentView setBackgroundColor:backgroundColor]; 332 if (frame && frame->view()) { 333 frame->view()->setTransparent(!drawsBackground); 334 Color color = colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]); 335 frame->view()->setBaseBackgroundColor(color); 336 frame->view()->setShouldUpdateWhileOffscreen([webView shouldUpdateWhileOffscreen]); 321 if ([webView _usesDocumentViews]) { 322 // Don't call setDrawsBackground:YES here because it may be NO because of a load 323 // in progress; WebFrameLoaderClient keeps it set to NO during the load process. 324 WebFrame *webFrame = kit(frame); 325 if (!drawsBackground) 326 [[[webFrame frameView] _scrollView] setDrawsBackground:NO]; 327 [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor]; 328 id documentView = [[webFrame frameView] documentView]; 329 if ([documentView respondsToSelector:@selector(setDrawsBackground:)]) 330 [documentView setDrawsBackground:drawsBackground]; 331 if ([documentView respondsToSelector:@selector(setBackgroundColor:)]) 332 [documentView setBackgroundColor:backgroundColor]; 333 } 334 335 if (FrameView* view = frame->view()) { 336 view->setTransparent(!drawsBackground); 337 view->setBaseBackgroundColor(colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace])); 338 view->setShouldUpdateWhileOffscreen([webView shouldUpdateWhileOffscreen]); 337 339 } 338 340 } … … 371 373 - (BOOL)_hasSelection 372 374 { 373 id documentView = [_private->webFrameView documentView]; 374 375 // optimization for common case to avoid creating potentially large selection string 376 if ([documentView isKindOfClass:[WebHTMLView class]]) 377 if (Frame* coreFrame = _private->coreFrame) 378 return coreFrame->selection()->isRange(); 379 380 if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) 381 return [[documentView selectedString] length] > 0; 382 383 return NO; 375 if ([getWebView(self) _usesDocumentViews]) { 376 id documentView = [_private->webFrameView documentView]; 377 378 // optimization for common case to avoid creating potentially large selection string 379 if ([documentView isKindOfClass:[WebHTMLView class]]) 380 if (Frame* coreFrame = _private->coreFrame) 381 return coreFrame->selection()->isRange(); 382 383 if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) 384 return [[documentView selectedString] length] > 0; 385 386 return NO; 387 } 388 389 Frame* coreFrame = _private->coreFrame; 390 return coreFrame && coreFrame->selection()->isRange(); 384 391 } 385 392 386 393 - (void)_clearSelection 387 394 { 395 ASSERT([getWebView(self) _usesDocumentViews]); 388 396 id documentView = [_private->webFrameView documentView]; 389 397 if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) … … 911 919 if (!view) 912 920 return; 921 ASSERT([getWebView(self) _usesDocumentViews]); 913 922 // FIXME: These are fake modifier keys here, but they should be real ones instead. 914 923 PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]), … … 924 933 if (!view) 925 934 return; 935 ASSERT([getWebView(self) _usesDocumentViews]); 926 936 // FIXME: These are fake modifier keys here, but they should be real ones instead. 927 937 PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]), … … 1180 1190 - (WebFrameView *)frameView 1181 1191 { 1192 ASSERT(!getWebView(self) || [getWebView(self) _usesDocumentViews]); 1182 1193 return _private->webFrameView; 1183 1194 } -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r44313 r44379 102 102 #import <WebCore/Page.h> 103 103 #import <WebCore/PlatformKeyboardEvent.h> 104 #import <WebCore/PlatformMouseEvent.h>105 104 #import <WebCore/Range.h> 106 105 #import <WebCore/SelectionController.h> … … 239 238 @interface NSWindow (WebNSWindowDetails) 240 239 - (id)_newFirstResponderAfterResigning; 241 - (void)_setForceActiveControls:(BOOL)flag;242 240 @end 243 241 … … 1415 1413 // 4) NSAccessibilityHitTest relies on this for checking the cursor position. 1416 1414 // Our check for that is whether the event is NSFlagsChanged. This works 1417 // for VoiceOver's cntl-opt-f5 command (move focus to item under cursor)1418 // and Dictionary's cmd-cntl-D (open dictionary popup for item under cursor).1415 // for VoiceOver's Control-Option-F5 command (move focus to item under cursor) 1416 // and Dictionary's Command-Control-D (open dictionary popup for item under cursor). 1419 1417 // This is of course a hack. 1420 1418 … … 1585 1583 // If we are moving out of a view (or frame), let's pretend the mouse moved 1586 1584 // all the way out of that view. But we have to account for scrolling, because 1587 // khtmldoesn't understand our clipping.1585 // WebCore doesn't understand our clipping. 1588 1586 NSRect visibleRect = [[[[lastHitView _frame] frameView] _scrollView] documentVisibleRect]; 1589 1587 float yScroll = visibleRect.origin.y; 1590 1588 float xScroll = visibleRect.origin.x; 1591 1589 1592 event = [NSEvent mouseEventWithType:NSMouseMoved1593 location:NSMakePoint(-1 - xScroll, -1 - yScroll)1594 1595 1596 1597 1598 1590 NSEvent *event = [NSEvent mouseEventWithType:NSMouseMoved 1591 location:NSMakePoint(-1 - xScroll, -1 - yScroll) 1592 modifierFlags:[[NSApp currentEvent] modifierFlags] 1593 timestamp:[NSDate timeIntervalSinceReferenceDate] 1594 windowNumber:[[view window] windowNumber] 1595 context:[[NSApp currentEvent] context] 1596 eventNumber:0 clickCount:0 pressure:0]; 1599 1597 if (Frame* lastHitCoreFrame = core([lastHitView _frame])) 1600 1598 lastHitCoreFrame->eventHandler()->mouseMoved(event); … … 1770 1768 } 1771 1769 1772 - (void)_startAutoscrollTimer: 1770 - (void)_startAutoscrollTimer:(NSEvent *)triggerEvent 1773 1771 { 1774 1772 if (_private->autoscrollTimer == nil) { … … 3077 3075 page->contextMenuController()->clearContextMenu(); 3078 3076 coreFrame->eventHandler()->mouseDown(event); 3079 BOOL handledEvent = coreFrame->eventHandler()->sendContextMenuEvent( PlatformMouseEvent(event));3077 BOOL handledEvent = coreFrame->eventHandler()->sendContextMenuEvent(event); 3080 3078 _private->handlingMouseDownEvent = NO; 3081 3079 … … 3369 3367 if (hitHTMLView) { 3370 3368 bool result = false; 3371 if ([hitHTMLView _isSelectionEvent:event]) 3369 if ([hitHTMLView _isSelectionEvent:event]) { 3372 3370 if (Frame* coreFrame = core([hitHTMLView _frame])) { 3373 3371 [hitHTMLView _setMouseDownEvent:event]; … … 3375 3373 [hitHTMLView _setMouseDownEvent:nil]; 3376 3374 } 3375 } 3377 3376 return result; 3378 3377 } -
trunk/WebKit/mac/WebView/WebUIDelegatePrivate.h
r43639 r44379 127 127 - (BOOL)webView:(WebView *)sender frame:(WebFrame *)frame requestGeolocationPermission:(WebGeolocation *)geolocation securityOrigin:(WebSecurityOrigin *)origin; 128 128 129 /*! 130 @method webView:printFrame: 131 @abstract Informs that a WebFrame needs to be printed 132 @param webView The WebView sending the delegate method 133 @param frameView The WebFrame needing to be printed 134 @discussion This method is called when a script or user requests the page to be printed. 135 */ 136 - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; 137 129 138 @end -
trunk/WebKit/mac/WebView/WebView.mm
r44181 r44379 88 88 #import "WebScriptDebugDelegate.h" 89 89 #import "WebSystemInterface.h" 90 #import "WebTextCompletionController.h" 90 91 #import "WebTextIterator.h" 91 92 #import "WebUIDelegate.h" … … 153 154 #import <WebKit/WebDashboardRegion.h> 154 155 #endif 156 157 @class NSTextInputContext; 158 159 @interface NSResponder (WebNSResponderDetails) 160 - (NSTextInputContext *)inputContext; 161 @end 162 163 @interface NSSpellChecker (WebNSSpellCheckerDetails) 164 - (void)_preflightChosenSpellServer; 165 @end 166 167 @interface NSView (WebNSViewDetails) 168 - (NSView *)_hitTest:(NSPoint *)aPoint dragTypes:(NSSet *)types; 169 - (void)_autoscrollForDraggingInfo:(id)dragInfo timeDelta:(NSTimeInterval)repeatDelta; 170 - (BOOL)_shouldAutoscrollForDraggingInfo:(id)dragInfo; 171 @end 172 173 @interface NSWindow (WebNSWindowDetails) 174 - (id)_oldFirstResponderBeforeBecoming; 175 @end 155 176 156 177 using namespace WebCore; … … 303 324 #endif 304 325 305 306 326 static BOOL s_didSetCacheModel; 307 327 static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer; … … 309 329 static BOOL applicationIsTerminating; 310 330 static int pluginDatabaseClientCount = 0; 331 332 static WebView *lastMouseoverView; 311 333 312 334 #ifndef NDEBUG … … 314 336 #endif 315 337 316 @interface NSSpellChecker (AppKitSecretsIKnow) 317 - (void)_preflightChosenSpellServer; 318 @end 319 320 @interface NSView (AppKitSecretsIKnow) 321 - (NSView *)_hitTest:(NSPoint *)aPoint dragTypes:(NSSet *)types; 322 - (void)_autoscrollForDraggingInfo:(id)dragInfo timeDelta:(NSTimeInterval)repeatDelta; 323 - (BOOL)_shouldAutoscrollForDraggingInfo:(id)dragInfo; 324 @end 325 326 @interface NSWindow (AppKitSecretsIKnow) 327 - (id)_oldFirstResponderBeforeBecoming; 328 @end 329 330 @interface NSObject (ValidateWithoutDelegate) 338 @interface NSObject (WebValidateWithoutDelegate) 331 339 - (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item; 332 340 @end … … 422 430 423 431 // When this flag is set, we will not make any subviews underneath this WebView. This means no WebFrameViews and no WebHTMLViews. 424 BOOL use DocumentViews;432 BOOL usesDocumentViews; 425 433 426 434 #if USE(ACCELERATED_COMPOSITING) … … 437 445 438 446 NSSize lastLayoutSize; 447 448 BOOL ignoringMouseDraggedEvents; 449 450 NSEvent *mouseDownEvent; // Kept after handling the event. 451 BOOL handlingMouseDownEvent; 452 NSEvent *keyDownEvent; // Kept after handling the event. 453 454 WebTextCompletionController *completionController; 455 456 NSTimer *autoscrollTimer; 457 NSEvent *autoscrollTriggerEvent; 458 459 CFRunLoopTimerRef updateMouseoverTimer; 439 460 } 440 461 @end … … 754 775 - (BOOL)_usesDocumentViews 755 776 { 756 return _private->use DocumentViews;777 return _private->usesDocumentViews; 757 778 } 758 779 … … 773 794 _private->drawsBackground = YES; 774 795 _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain]; 775 _private->use DocumentViews = usesDocumentViews;796 _private->usesDocumentViews = usesDocumentViews; 776 797 777 798 WebFrameView *frameView = nil; 778 if (_private->use DocumentViews) {799 if (_private->usesDocumentViews) { 779 800 NSRect f = [self frame]; 780 801 frameView = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)]; … … 900 921 - (void)drawSingleRect:(NSRect)rect 901 922 { 902 ASSERT(!_private->use DocumentViews);923 ASSERT(!_private->usesDocumentViews); 903 924 904 925 [NSGraphicsContext saveGraphicsState]; … … 924 945 - (BOOL)isFlipped 925 946 { 926 return _private && !_private->use DocumentViews;947 return _private && !_private->usesDocumentViews; 927 948 } 928 949 … … 930 951 { 931 952 if (!NSEqualSizes(_private->lastLayoutSize, size)) { 932 Frame* frame = core([self mainFrame]);953 Frame* frame = [self _mainCoreFrame]; 933 954 // FIXME: Viewless WebKit is broken with Safari banners (e.g., the Find banner). We'll have to figure out a way for 934 955 // Safari to communicate that this space is being consumed. For WebKit with document views, there's no 935 956 // need to do an explicit resize, since WebFrameViews have auto resizing turned on and will handle changing 936 957 // their bounds automatically. See <rdar://problem/6835573> for details. 937 if (!_private->use DocumentViews)958 if (!_private->usesDocumentViews) 938 959 frame->view()->resize(IntSize(size)); 939 960 frame->view()->setNeedsLayout(); … … 946 967 947 968 #if USE(ACCELERATED_COMPOSITING) || !defined(BUILDING_ON_TIGER) 969 948 970 - (void)_viewWillDrawInternal 949 971 { 950 Frame* frame = core([self mainFrame]);972 Frame* frame = [self _mainCoreFrame]; 951 973 if (frame && frame->view()) 952 974 frame->view()->layoutIfNeededRecursive(); 953 975 } 976 954 977 #endif 955 978 … … 958 981 - (void)viewWillDraw 959 982 { 960 if (!_private->use DocumentViews)983 if (!_private->usesDocumentViews) 961 984 [self _viewWillDrawInternal]; 962 985 [super viewWillDraw]; … … 968 991 - (void)drawRect:(NSRect)rect 969 992 { 970 if (_private->use DocumentViews)993 if (_private->usesDocumentViews) 971 994 return [super drawRect:rect]; 972 995 … … 1160 1183 return; 1161 1184 1185 if (lastMouseoverView == self) 1186 lastMouseoverView = nil; 1187 1162 1188 #ifndef NDEBUG 1163 1189 WTF::RefCountedLeakCounter::cancelMessageSuppression(webViewIsOpen); … … 1171 1197 } 1172 1198 1173 if (Frame* mainFrame = core([self mainFrame]))1199 if (Frame* mainFrame = [self _mainCoreFrame]) 1174 1200 mainFrame->loader()->detachFromParent(); 1175 1201 … … 1931 1957 { 1932 1958 // Only return regions from main frame. 1933 Frame* mainFrame = core([self mainFrame]);1959 Frame* mainFrame = [self _mainCoreFrame]; 1934 1960 if (!mainFrame) 1935 1961 return nil; … … 2051 2077 - (void)setProhibitsMainFrameScrolling:(BOOL)prohibits 2052 2078 { 2053 Frame* mainFrame = core([self mainFrame]); 2054 if (mainFrame) 2079 if (Frame* mainFrame = [self _mainCoreFrame]) 2055 2080 mainFrame->view()->setProhibitsScrolling(prohibits); 2056 2081 } … … 2064 2089 - (void)_setInViewSourceMode:(BOOL)flag 2065 2090 { 2066 Frame* mainFrame = core([self mainFrame]); 2067 if (mainFrame) 2091 if (Frame* mainFrame = [self _mainCoreFrame]) 2068 2092 mainFrame->setInViewSourceMode(flag); 2069 2093 } … … 2071 2095 - (BOOL)_inViewSourceMode 2072 2096 { 2073 Frame* mainFrame = core([self mainFrame]);2097 Frame* mainFrame = [self _mainCoreFrame]; 2074 2098 return mainFrame && mainFrame->inViewSourceMode(); 2075 2099 } … … 2114 2138 - (void)_attachScriptDebuggerToAllFrames 2115 2139 { 2116 for (Frame* frame = core([self mainFrame]); frame; frame = frame->tree()->traverseNext())2140 for (Frame* frame = [self _mainCoreFrame]; frame; frame = frame->tree()->traverseNext()) 2117 2141 [kit(frame) _attachScriptDebugger]; 2118 2142 } … … 2120 2144 - (void)_detachScriptDebuggerFromAllFrames 2121 2145 { 2122 for (Frame* frame = core([self mainFrame]); frame; frame = frame->tree()->traverseNext())2146 for (Frame* frame = [self _mainCoreFrame]; frame; frame = frame->tree()->traverseNext()) 2123 2147 [kit(frame) _detachScriptDebugger]; 2124 2148 } … … 2183 2207 IntPoint rectEnd(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); 2184 2208 2185 Frame* coreFrame = core([self mainFrame]);2209 Frame* coreFrame = [self _mainCoreFrame]; 2186 2210 if (!coreFrame) 2187 2211 return nil; … … 2217 2241 - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value 2218 2242 { 2219 Frame* coreFrame = core([self mainFrame]);2243 Frame* coreFrame = [self _mainCoreFrame]; 2220 2244 if (!coreFrame) 2221 2245 return; … … 2273 2297 return handCursor().impl(); 2274 2298 } 2275 2276 #if USE(ACCELERATED_COMPOSITING)2277 2278 - (BOOL)_needsOneShotDrawingSynchronization2279 {2280 return _private->needsOneShotDrawingSynchronization;2281 }2282 2283 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization2284 {2285 _private->needsOneShotDrawingSynchronization = needsSynchronization;2286 }2287 2288 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame2289 {2290 BOOL entering = _private->acceleratedFramesCount == 0;2291 if (entering)2292 [self willChangeValueForKey:UsingAcceleratedCompositingProperty];2293 ++_private->acceleratedFramesCount;2294 if (entering)2295 [self didChangeValueForKey:UsingAcceleratedCompositingProperty];2296 }2297 2298 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame2299 {2300 BOOL leaving = _private->acceleratedFramesCount == 1;2301 ASSERT(_private->acceleratedFramesCount > 0);2302 2303 if (leaving)2304 [self willChangeValueForKey:UsingAcceleratedCompositingProperty];2305 --_private->acceleratedFramesCount;2306 if (leaving)2307 [self didChangeValueForKey:UsingAcceleratedCompositingProperty];2308 }2309 2310 #endif2311 2299 2312 2300 - (BOOL)_isUsingAcceleratedCompositing … … 2714 2702 - (void)addWindowObserversForWindow:(NSWindow *)window 2715 2703 { 2716 if (!_private->use DocumentViews && window) {2704 if (!_private->usesDocumentViews && window) { 2717 2705 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) 2718 2706 name:NSWindowDidBecomeKeyNotification object:nil]; … … 2727 2715 { 2728 2716 NSWindow *window = [self window]; 2729 if (!_private->use DocumentViews && window) {2717 if (!_private->usesDocumentViews && window) { 2730 2718 [[NSNotificationCenter defaultCenter] removeObserver:self 2731 2719 name:NSWindowDidBecomeKeyNotification object:nil]; … … 2780 2768 - (void)_updateFocusedAndActiveState 2781 2769 { 2782 ASSERT(!_private->use DocumentViews);2770 ASSERT(!_private->usesDocumentViews); 2783 2771 [self _updateFocusedAndActiveStateForFrame:[self mainFrame]]; 2784 2772 } … … 2790 2778 return; 2791 2779 2792 Page* page = frame->page();2793 if (!page)2794 return;2795 2796 2780 NSWindow *window = [self window]; 2797 2781 BOOL windowIsKey = [window isKeyWindow]; 2782 2783 NSView *contentView = _private->usesDocumentViews ? (NSView *)[[self mainFrame] frameView] : self; 2784 NSResponder *firstResponder = [window firstResponder]; 2785 if ([firstResponder isKindOfClass:[NSView class]] && [(NSView *)firstResponder isDescendantOf:contentView]) { 2786 BOOL documentViewIsResigningFirstResponder; 2787 if (!_private->usesDocumentViews) { 2788 // FIXME: WebView probably needs a "resigning first responder" state just as WebHTMLView has. 2789 documentViewIsResigningFirstResponder = NO; 2790 } else { 2791 id <WebDocumentView> documentView = [[[self mainFrame] frameView] documentView]; 2792 documentViewIsResigningFirstResponder = [documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isResigningFirstResponder]; 2793 } 2794 _private->page->focusController()->setActive(windowIsKey && !documentViewIsResigningFirstResponder); 2795 } 2796 2798 2797 BOOL windowOrSheetIsKey = windowIsKey || [[window attachedSheet] isKeyWindow]; 2799 2800 WebFrameView *mainFrameView = [[self mainFrame] frameView]; 2801 id <WebDocumentView> documentView = [mainFrameView documentView]; 2802 BOOL documentViewIsResigningFirstResponder = [documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isResigningFirstResponder]; 2803 2804 NSResponder *firstResponder = [window firstResponder]; 2805 if ([firstResponder isKindOfClass:[NSView class]] 2806 && [(NSView *)firstResponder isDescendantOf:mainFrameView]) 2807 page->focusController()->setActive(windowIsKey && !documentViewIsResigningFirstResponder); 2808 2809 Frame* focusedFrame = page->focusController()->focusedOrMainFrame(); 2810 frame->selection()->setFocused(frame == focusedFrame && windowOrSheetIsKey); 2798 frame->selection()->setFocused(frame == _private->page->focusController()->focusedOrMainFrame() && windowOrSheetIsKey); 2811 2799 } 2812 2800 2813 2801 - (void)_windowDidBecomeKey:(NSNotification *)notification 2814 2802 { 2815 ASSERT(!_private->use DocumentViews);2803 ASSERT(!_private->usesDocumentViews); 2816 2804 NSWindow *keyWindow = [notification object]; 2817 2805 if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) … … 2821 2809 - (void)_windowDidResignKey:(NSNotification *)notification 2822 2810 { 2823 ASSERT(!_private->use DocumentViews);2811 ASSERT(!_private->usesDocumentViews); 2824 2812 NSWindow *formerKeyWindow = [notification object]; 2825 2813 if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) … … 2829 2817 - (void)_windowWillOrderOnScreen:(NSNotification *)notification 2830 2818 { 2831 ASSERT(!_private->use DocumentViews);2819 ASSERT(!_private->usesDocumentViews); 2832 2820 if (![self shouldUpdateWhileOffscreen]) 2833 2821 [self setNeedsDisplay:YES]; … … 2950 2938 { 2951 2939 // This can be called in initialization, before _private has been set up (3465613) 2952 if (!_private) 2953 return nil; 2954 if (!_private->page) 2940 if (!_private || !_private->page) 2955 2941 return nil; 2956 2942 return kit(_private->page->mainFrame()); … … 2959 2945 - (WebFrame *)selectedFrame 2960 2946 { 2961 // If the first responder is a view in our tree, we get the frame containing the first responder. 2962 // This is faster than searching the frame hierarchy, and will give us a result even in the case 2963 // where the focused frame doesn't actually contain a selection. 2964 WebFrame *focusedFrame = [self _focusedFrame]; 2965 if (focusedFrame) 2966 return focusedFrame; 2947 if (_private->usesDocumentViews) { 2948 // If the first responder is a view in our tree, we get the frame containing the first responder. 2949 // This is faster than searching the frame hierarchy, and will give us a result even in the case 2950 // where the focused frame doesn't actually contain a selection. 2951 WebFrame *focusedFrame = [self _focusedFrame]; 2952 if (focusedFrame) 2953 return focusedFrame; 2954 } 2967 2955 2968 2956 // If the first responder is outside of our view tree, we search for a frame containing a selection. … … 2980 2968 } 2981 2969 2982 - (void)setMaintainsBackForwardList: 2970 - (void)setMaintainsBackForwardList:(BOOL)flag 2983 2971 { 2984 2972 if (!_private->page) … … 3032 3020 // FIXME: it would be nice to rework this code so that _private->zoomMultiplier doesn't exist and callers 3033 3021 // all access _private->page->settings(). 3034 Frame* coreFrame = core([self mainFrame]);3022 Frame* coreFrame = [self _mainCoreFrame]; 3035 3023 if (coreFrame) 3036 3024 coreFrame->setZoomFactor(m, isTextOnly); … … 3179 3167 if (encoding == oldEncoding || [encoding isEqualToString:oldEncoding]) 3180 3168 return; 3181 if (Frame* mainFrame = core([self mainFrame]))3169 if (Frame* mainFrame = [self _mainCoreFrame]) 3182 3170 mainFrame->loader()->reloadWithOverrideEncoding(encoding); 3183 3171 } … … 3220 3208 - (WebScriptObject *)windowScriptObject 3221 3209 { 3222 Frame* coreFrame = core([self mainFrame]);3210 Frame* coreFrame = [self _mainCoreFrame]; 3223 3211 if (!coreFrame) 3224 3212 return nil; … … 3239 3227 return; 3240 3228 3241 Frame* coreFrame = core([self mainFrame]); 3242 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 3243 [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow]; 3229 Frame* coreFrame = [self _mainCoreFrame]; 3230 if (_private->usesDocumentViews) { 3231 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 3232 [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow]; 3233 } 3244 3234 if (_private->hostWindow && [self window] != _private->hostWindow) 3245 3235 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_private->hostWindow]; … … 3248 3238 [_private->hostWindow release]; 3249 3239 _private->hostWindow = [hostWindow retain]; 3250 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 3251 [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow]; 3240 if (_private->usesDocumentViews) { 3241 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 3242 [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow]; 3243 } 3252 3244 } 3253 3245 … … 3285 3277 } 3286 3278 3287 // The following 2 internal NSView methods are called on the drag destination bymake scrolling while dragging work.3279 // The following 2 internal NSView methods are called on the drag destination to make scrolling while dragging work. 3288 3280 // Scrolling while dragging will only work if the drag destination is in a scroll view. The WebView is the drag destination. 3289 3281 // When dragging to a WebView, the document subview should scroll, but it doesn't because it is not the drag destination. … … 3354 3346 } 3355 3347 3356 - (NSView *)_hitTest:(NSPoint *) aPoint dragTypes:(NSSet *)types3357 { 3358 NSView *hitView = [super _hitTest: aPoint dragTypes:types];3359 if (!hitView && [[self superview] mouse:* aPoint inRect:[self frame]]) {3348 - (NSView *)_hitTest:(NSPoint *)point dragTypes:(NSSet *)types 3349 { 3350 NSView *hitView = [super _hitTest:point dragTypes:types]; 3351 if (!hitView && [[self superview] mouse:*point inRect:[self frame]]) 3360 3352 return self; 3361 } else { 3362 return hitView; 3363 } 3353 return hitView; 3364 3354 } 3365 3355 3366 3356 - (BOOL)acceptsFirstResponder 3367 3357 { 3368 return [[[self mainFrame] frameView] acceptsFirstResponder]; 3358 if (_private->usesDocumentViews) 3359 return [[[self mainFrame] frameView] acceptsFirstResponder]; 3360 3361 // FIXME (Viewless): Need more code from WebHTMLView here. 3362 return YES; 3369 3363 } 3370 3364 3371 3365 - (BOOL)becomeFirstResponder 3372 3366 { 3373 if (_private->becomingFirstResponder) { 3374 // Fix for unrepro infinite recursion reported in radar 4448181. If we hit this assert on 3375 // a debug build, we should figure out what causes the problem and do a better fix. 3376 ASSERT_NOT_REACHED(); 3377 return NO; 3378 } 3379 3380 // This works together with setNextKeyView to splice the WebView into 3381 // the key loop similar to the way NSScrollView does this. Note that 3382 // WebFrameView has very similar code. 3383 NSWindow *window = [self window]; 3384 WebFrameView *mainFrameView = [[self mainFrame] frameView]; 3385 3386 NSResponder *previousFirstResponder = [[self window] _oldFirstResponderBeforeBecoming]; 3387 BOOL fromOutside = ![previousFirstResponder isKindOfClass:[NSView class]] || (![(NSView *)previousFirstResponder isDescendantOf:self] && previousFirstResponder != self); 3388 3389 if ([window keyViewSelectionDirection] == NSSelectingPrevious) { 3390 NSView *previousValidKeyView = [self previousValidKeyView]; 3391 if ((previousValidKeyView != self) && (previousValidKeyView != mainFrameView)) { 3367 if (_private->usesDocumentViews) { 3368 if (_private->becomingFirstResponder) { 3369 // Fix for unrepro infinite recursion reported in Radar 4448181. If we hit this assert on 3370 // a debug build, we should figure out what causes the problem and do a better fix. 3371 ASSERT_NOT_REACHED(); 3372 return NO; 3373 } 3374 3375 // This works together with setNextKeyView to splice the WebView into 3376 // the key loop similar to the way NSScrollView does this. Note that 3377 // WebFrameView has very similar code. 3378 NSWindow *window = [self window]; 3379 WebFrameView *mainFrameView = [[self mainFrame] frameView]; 3380 3381 NSResponder *previousFirstResponder = [[self window] _oldFirstResponderBeforeBecoming]; 3382 BOOL fromOutside = ![previousFirstResponder isKindOfClass:[NSView class]] || (![(NSView *)previousFirstResponder isDescendantOf:self] && previousFirstResponder != self); 3383 3384 if ([window keyViewSelectionDirection] == NSSelectingPrevious) { 3385 NSView *previousValidKeyView = [self previousValidKeyView]; 3386 if (previousValidKeyView != self && previousValidKeyView != mainFrameView) { 3387 _private->becomingFirstResponder = YES; 3388 _private->becomingFirstResponderFromOutside = fromOutside; 3389 [window makeFirstResponder:previousValidKeyView]; 3390 _private->becomingFirstResponderFromOutside = NO; 3391 _private->becomingFirstResponder = NO; 3392 return YES; 3393 } 3394 return NO; 3395 } 3396 3397 if ([mainFrameView acceptsFirstResponder]) { 3392 3398 _private->becomingFirstResponder = YES; 3393 3399 _private->becomingFirstResponderFromOutside = fromOutside; 3394 [window makeFirstResponder: previousValidKeyView];3400 [window makeFirstResponder:mainFrameView]; 3395 3401 _private->becomingFirstResponderFromOutside = NO; 3396 3402 _private->becomingFirstResponder = NO; 3397 3403 return YES; 3398 } else { 3399 return NO; 3404 } 3405 3406 return NO; 3407 } 3408 3409 // FIXME (Viewless): Need more code from WebHTMLView here. 3410 return YES; 3411 } 3412 3413 - (NSView *)_webcore_effectiveFirstResponder 3414 { 3415 if (_private && _private->usesDocumentViews) { 3416 if (WebFrameView *frameView = [[self mainFrame] frameView]) 3417 return [frameView _webcore_effectiveFirstResponder]; 3418 } 3419 return [super _webcore_effectiveFirstResponder]; 3420 } 3421 3422 - (void)setNextKeyView:(NSView *)view 3423 { 3424 if (_private && _private->usesDocumentViews) { 3425 // This works together with becomeFirstResponder to splice the WebView into 3426 // the key loop similar to the way NSScrollView does this. Note that 3427 // WebFrameView has similar code. 3428 if (WebFrameView *mainFrameView = [[self mainFrame] frameView]) { 3429 [mainFrameView setNextKeyView:view]; 3430 return; 3400 3431 } 3401 3432 } 3402 3403 if ([mainFrameView acceptsFirstResponder]) { 3404 _private->becomingFirstResponder = YES; 3405 _private->becomingFirstResponderFromOutside = fromOutside; 3406 [window makeFirstResponder:mainFrameView]; 3407 _private->becomingFirstResponderFromOutside = NO; 3408 _private->becomingFirstResponder = NO; 3409 return YES; 3410 } 3411 3412 return NO; 3413 } 3414 3415 - (NSView *)_webcore_effectiveFirstResponder 3416 { 3417 WebFrameView *frameView = [[self mainFrame] frameView]; 3418 return frameView ? [frameView _webcore_effectiveFirstResponder] : [super _webcore_effectiveFirstResponder]; 3419 } 3420 3421 - (void)setNextKeyView:(NSView *)aView 3422 { 3423 // This works together with becomeFirstResponder to splice the WebView into 3424 // the key loop similar to the way NSScrollView does this. Note that 3425 // WebFrameView has very similar code. 3426 WebFrameView *mainFrameView = [[self mainFrame] frameView]; 3427 if (mainFrameView != nil) { 3428 [mainFrameView setNextKeyView:aView]; 3429 } else { 3430 [super setNextKeyView:aView]; 3431 } 3432 } 3433 3434 static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag) 3435 { 3436 Frame* coreFrame = core(curr); 3433 3434 [super setNextKeyView:view]; 3435 } 3436 3437 static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag) 3438 { 3439 Frame* coreFrame = core(frame); 3437 3440 return kit(forward 3438 3441 ? coreFrame->tree()->traverseNextWithWrap(wrapFlag) … … 3475 3478 if (!_private->page) 3476 3479 return 0.0; 3477 3478 3480 return _private->page->progress()->estimatedProgress(); 3479 3481 } … … 3641 3643 } while ([result isDescendantOf:previousView]); 3642 3644 return [previousView previousValidKeyView]; 3645 } 3646 3647 - (void)mouseDown:(NSEvent *)event 3648 { 3649 // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to 3650 // do the same work in the usesDocumentViews case. We don't want to maintain two 3651 // duplicate copies of this method. 3652 3653 if (_private->usesDocumentViews) { 3654 [super mouseDown:event]; 3655 return; 3656 } 3657 3658 // There's a chance that responding to this event will run a nested event loop, and 3659 // fetching a new event might release the old one. Retaining and then autoreleasing 3660 // the current event prevents that from causing a problem inside WebKit or AppKit code. 3661 [[event retain] autorelease]; 3662 3663 RetainPtr<WebView> protector = self; 3664 if ([[self inputContext] wantsToHandleMouseEvents] && [[self inputContext] handleMouseEvent:event]) 3665 return; 3666 3667 _private->handlingMouseDownEvent = YES; 3668 3669 // Record the mouse down position so we can determine drag hysteresis. 3670 [self _setMouseDownEvent:event]; 3671 3672 NSInputManager *currentInputManager = [NSInputManager currentInputManager]; 3673 if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event]) 3674 goto done; 3675 3676 [_private->completionController endRevertingChange:NO moveLeft:NO]; 3677 3678 // If the web page handles the context menu event and menuForEvent: returns nil, we'll get control click events here. 3679 // We don't want to pass them along to KHTML a second time. 3680 if (!([event modifierFlags] & NSControlKeyMask)) { 3681 _private->ignoringMouseDraggedEvents = NO; 3682 3683 // Don't do any mouseover while the mouse is down. 3684 [self _cancelUpdateMouseoverTimer]; 3685 3686 // Let WebCore get a chance to deal with the event. This will call back to us 3687 // to start the autoscroll timer if appropriate. 3688 if (Frame* frame = [self _mainCoreFrame]) 3689 frame->eventHandler()->mouseDown(event); 3690 } 3691 3692 done: 3693 _private->handlingMouseDownEvent = NO; 3694 } 3695 3696 - (void)mouseUp:(NSEvent *)event 3697 { 3698 // FIXME (Viewless): This method should be shared with WebHTMLView, which needs to 3699 // do the same work in the usesDocumentViews case. We don't want to maintain two 3700 // duplicate copies of this method. 3701 3702 if (_private->usesDocumentViews) { 3703 [super mouseUp:event]; 3704 return; 3705 } 3706 3707 // There's a chance that responding to this event will run a nested event loop, and 3708 // fetching a new event might release the old one. Retaining and then autoreleasing 3709 // the current event prevents that from causing a problem inside WebKit or AppKit code. 3710 [[event retain] autorelease]; 3711 3712 [self _setMouseDownEvent:nil]; 3713 3714 NSInputManager *currentInputManager = [NSInputManager currentInputManager]; 3715 if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event]) 3716 return; 3717 3718 [self retain]; 3719 3720 [self _stopAutoscrollTimer]; 3721 if (Frame* frame = [self _mainCoreFrame]) 3722 frame->eventHandler()->mouseUp(event); 3723 [self _updateMouseoverWithFakeEvent]; 3724 3725 [self release]; 3643 3726 } 3644 3727 … … 3937 4020 3938 4021 _private->hoverFeedbackSuspended = newValue; 3939 id <WebDocumentView> documentView = [[[self mainFrame] frameView] documentView]; 3940 // FIXME: in a perfect world we'd do this in a general way that worked with any document view, 3941 // such as by calling a protocol method or using respondsToSelector or sending a notification. 3942 // But until there is any need for these more general solutions, we'll just hardwire it to work 3943 // with WebHTMLView. 3944 // Note that _hoverFeedbackSuspendedChanged needs to be called only on the main WebHTMLView, not 3945 // on each subframe separately. 3946 if ([documentView isKindOfClass:[WebHTMLView class]]) 3947 [(WebHTMLView *)documentView _hoverFeedbackSuspendedChanged]; 4022 4023 if (_private->usesDocumentViews) { 4024 id <WebDocumentView> documentView = [[[self mainFrame] frameView] documentView]; 4025 // FIXME: in a perfect world we'd do this in a general way that worked with any document view, 4026 // such as by calling a protocol method or using respondsToSelector or sending a notification. 4027 // But until there is any need for these more general solutions, we'll just hardwire it to work 4028 // with WebHTMLView. 4029 // Note that _hoverFeedbackSuspendedChanged needs to be called only on the main WebHTMLView, not 4030 // on each subframe separately. 4031 if ([documentView isKindOfClass:[WebHTMLView class]]) 4032 [(WebHTMLView *)documentView _hoverFeedbackSuspendedChanged]; 4033 return; 4034 } 4035 4036 [self _updateMouseoverWithFakeEvent]; 3948 4037 } 3949 4038 … … 4003 4092 - (BOOL)shouldClose 4004 4093 { 4005 Frame* coreFrame = core([self mainFrame]);4094 Frame* coreFrame = [self _mainCoreFrame]; 4006 4095 if (!coreFrame) 4007 4096 return YES; … … 4066 4155 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)script 4067 4156 { 4068 Frame* coreFrame = core([self mainFrame]);4157 Frame* coreFrame = [self _mainCoreFrame]; 4069 4158 if (!coreFrame) 4070 4159 return nil; … … 4441 4530 if (!_private->tabKeyCyclesThroughElementsChanged && _private->page) 4442 4531 _private->page->setTabKeyCyclesThroughElements(!flag); 4443 Frame* mainFrame = core([self mainFrame]);4532 Frame* mainFrame = [self _mainCoreFrame]; 4444 4533 if (mainFrame) { 4445 4534 if (flag) { … … 5118 5207 if (_private->closed) 5119 5208 return nil; 5209 ASSERT(_private->usesDocumentViews); 5120 5210 NSView *view = [self hitTest:[[self superview] convertPoint:point fromView:nil]]; 5121 5211 if (![view isDescendantOf:[[self mainFrame] frameView]]) … … 5362 5452 _private->insertionPasteboard = pasteboard; 5363 5453 } 5454 5455 - (void)_setMouseDownEvent:(NSEvent *)event 5456 { 5457 ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown); 5458 5459 if (event == _private->mouseDownEvent) 5460 return; 5461 5462 [event retain]; 5463 [_private->mouseDownEvent release]; 5464 _private->mouseDownEvent = event; 5465 } 5466 5467 - (void)_cancelUpdateMouseoverTimer 5468 { 5469 if (_private->updateMouseoverTimer) { 5470 CFRunLoopTimerInvalidate(_private->updateMouseoverTimer); 5471 CFRelease(_private->updateMouseoverTimer); 5472 _private->updateMouseoverTimer = NULL; 5473 } 5474 } 5475 5476 - (void)_stopAutoscrollTimer 5477 { 5478 NSTimer *timer = _private->autoscrollTimer; 5479 _private->autoscrollTimer = nil; 5480 [_private->autoscrollTriggerEvent release]; 5481 _private->autoscrollTriggerEvent = nil; 5482 [timer invalidate]; 5483 [timer release]; 5484 } 5485 5486 + (void)_updateMouseoverWithEvent:(NSEvent *)event 5487 { 5488 WebView *oldView = lastMouseoverView; 5489 5490 lastMouseoverView = nil; 5491 5492 NSView *contentView = [[event window] contentView]; 5493 NSPoint locationForHitTest = [[contentView superview] convertPoint:[event locationInWindow] fromView:nil]; 5494 for (NSView *hitView = [contentView hitTest:locationForHitTest]; hitView; hitView = [hitView superview]) { 5495 if ([hitView isKindOfClass:[WebView class]]) { 5496 lastMouseoverView = static_cast<WebView *>(hitView); 5497 break; 5498 } 5499 } 5500 5501 if (lastMouseoverView && lastMouseoverView->_private->hoverFeedbackSuspended) 5502 lastMouseoverView = nil; 5503 5504 if (lastMouseoverView != oldView) { 5505 if (Frame* oldCoreFrame = [oldView _mainCoreFrame]) { 5506 NSEvent *oldViewEvent = [NSEvent mouseEventWithType:NSMouseMoved 5507 location:NSMakePoint(-1, -1) 5508 modifierFlags:[[NSApp currentEvent] modifierFlags] 5509 timestamp:[NSDate timeIntervalSinceReferenceDate] 5510 windowNumber:[[oldView window] windowNumber] 5511 context:[[NSApp currentEvent] context] 5512 eventNumber:0 clickCount:0 pressure:0]; 5513 oldCoreFrame->eventHandler()->mouseMoved(oldViewEvent); 5514 } 5515 } 5516 5517 if (!lastMouseoverView) 5518 return; 5519 5520 if (Frame* coreFrame = core([lastMouseoverView mainFrame])) 5521 coreFrame->eventHandler()->mouseMoved(event); 5522 } 5523 5524 - (void)_updateMouseoverWithFakeEvent 5525 { 5526 [self _cancelUpdateMouseoverTimer]; 5527 5528 NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved 5529 location:[[self window] convertScreenToBase:[NSEvent mouseLocation]] 5530 modifierFlags:[[NSApp currentEvent] modifierFlags] 5531 timestamp:[NSDate timeIntervalSinceReferenceDate] 5532 windowNumber:[[self window] windowNumber] 5533 context:[[NSApp currentEvent] context] 5534 eventNumber:0 clickCount:0 pressure:0]; 5535 5536 [[self class] _updateMouseoverWithEvent:fakeEvent]; 5537 } 5538 5539 - (void)_setToolTip:(NSString *)toolTip 5540 { 5541 if (_private->usesDocumentViews) { 5542 id documentView = [[[self selectedFrame] frameView] documentView]; 5543 if ([documentView isKindOfClass:[WebHTMLView class]]) 5544 [documentView _setToolTip:toolTip]; 5545 return; 5546 } 5547 5548 // FIXME (Viewless): Code to handle tooltips needs to move into WebView. 5549 } 5550 5551 - (void)_selectionChanged 5552 { 5553 if (_private->usesDocumentViews) { 5554 id documentView = [[[self selectedFrame] frameView] documentView]; 5555 if ([documentView isKindOfClass:[WebHTMLView class]]) 5556 [documentView _selectionChanged]; 5557 return; 5558 } 5559 5560 // FIXME (Viewless): We'll need code here. 5561 } 5562 5563 - (Frame*)_mainCoreFrame 5564 { 5565 return (_private && _private->page) ? _private->page->mainFrame() : 0; 5566 } 5567 5568 #if USE(ACCELERATED_COMPOSITING) 5569 5570 - (BOOL)_needsOneShotDrawingSynchronization 5571 { 5572 return _private->needsOneShotDrawingSynchronization; 5573 } 5574 5575 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization 5576 { 5577 _private->needsOneShotDrawingSynchronization = needsSynchronization; 5578 } 5579 5580 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame 5581 { 5582 BOOL entering = _private->acceleratedFramesCount == 0; 5583 if (entering) 5584 [self willChangeValueForKey:UsingAcceleratedCompositingProperty]; 5585 ++_private->acceleratedFramesCount; 5586 if (entering) 5587 [self didChangeValueForKey:UsingAcceleratedCompositingProperty]; 5588 } 5589 5590 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame 5591 { 5592 BOOL leaving = _private->acceleratedFramesCount == 1; 5593 ASSERT(_private->acceleratedFramesCount > 0); 5594 5595 if (leaving) 5596 [self willChangeValueForKey:UsingAcceleratedCompositingProperty]; 5597 --_private->acceleratedFramesCount; 5598 if (leaving) 5599 [self didChangeValueForKey:UsingAcceleratedCompositingProperty]; 5600 } 5601 5602 static void viewUpdateRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActivity, void* info) 5603 { 5604 WebView* webView = reinterpret_cast<WebView*>(info); 5605 [webView _viewWillDrawInternal]; 5606 [webView->_private _clearViewUpdateRunLoopObserver]; 5607 } 5608 5609 - (void)_scheduleViewUpdate 5610 { 5611 // This is the compositing equivalent of -viewWillDraw. When we know that compositing layers 5612 // have been set as needing display, we have to make an eager layout happen before the 5613 // layers get committed by CoreAnimation. 5614 5615 if (_private->viewUpdateRunLoopObserver) 5616 return; 5617 5618 // Run before AppKit does its window update. 5619 const CFIndex runLoopOrder = NSDisplayWindowRunLoopOrdering - 1; 5620 5621 // The WebView always outlives the observer, so no need to retain/release. 5622 CFRunLoopObserverContext context = { 0, self, 0, 0, 0 }; 5623 5624 _private->viewUpdateRunLoopObserver = CFRunLoopObserverCreate(NULL, 5625 kCFRunLoopBeforeWaiting | kCFRunLoopExit, FALSE /* one shot */, 5626 runLoopOrder, viewUpdateRunLoopObserverCallBack, &context); 5627 5628 CFRunLoopAddObserver(CFRunLoopGetCurrent(), _private->viewUpdateRunLoopObserver, kCFRunLoopCommonModes); 5629 } 5630 5631 #endif 5364 5632 5365 5633 @end … … 5894 6162 } 5895 6163 5896 #if USE(ACCELERATED_COMPOSITING)5897 static void viewUpdateRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActivity, void* info)5898 {5899 WebView* webView = reinterpret_cast<WebView*>(info);5900 [webView _viewWillDrawInternal];5901 [webView->_private _clearViewUpdateRunLoopObserver];5902 }5903 5904 - (void)_scheduleViewUpdate5905 {5906 // This is the compositing equivalent of -viewWillDraw. When we know that compositing layers5907 // have been set as needing display, we have to make an eager layout happen before the5908 // layers get committed by CA.5909 if (!_private->viewUpdateRunLoopObserver) {5910 const CFIndex runLoopOrder = NSDisplayWindowRunLoopOrdering-1; // Run before AppKit does its window update5911 CFRunLoopObserverContext context = {5912 0,5913 reinterpret_cast<void*>(self),5914 NULL, // The WebView always outlives the observer, so no need to retain/release.5915 NULL,5916 NULL5917 };5918 _private->viewUpdateRunLoopObserver = CFRunLoopObserverCreate(NULL, kCFRunLoopBeforeWaiting | kCFRunLoopExit, false /* one shot */,5919 runLoopOrder, viewUpdateRunLoopObserverCallBack, &context);5920 5921 CFRunLoopAddObserver(CFRunLoopGetCurrent(), _private->viewUpdateRunLoopObserver, kCFRunLoopCommonModes);5922 }5923 5924 }5925 #endif5926 5927 6164 @end 5928 6165 -
trunk/WebKit/mac/WebView/WebViewInternal.h
r42208 r44379 39 39 #ifdef __cplusplus 40 40 namespace WebCore { 41 class Frame; 42 class KURL; 41 43 class KeyboardEvent; 42 class KURL;43 44 class Page; 44 45 class String; 45 46 } 46 typedef WebCore::KeyboardEvent WebCoreKeyboardEvent;47 typedef WebCore::Page WebCorePage;48 #else49 @class WebCoreKeyboardEvent;50 @class WebCorePage;51 47 #endif 52 48 … … 55 51 @class WebNodeHighlight; 56 52 53 #ifdef __cplusplus 54 57 55 @interface WebView (WebViewEditingExtras) 58 - (BOOL)_interceptEditingKeyEvent:(WebCore KeyboardEvent*)event shouldSaveCommand:(BOOL)shouldSave;56 - (BOOL)_interceptEditingKeyEvent:(WebCore::KeyboardEvent*)event shouldSaveCommand:(BOOL)shouldSave; 59 57 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag; 60 58 @end … … 67 65 68 66 @interface WebView (WebViewInternal) 69 #ifdef __cplusplus 67 68 - (WebCore::Frame*)_mainCoreFrame; 69 70 70 - (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url; 71 71 - (WebCore::KeyboardUIMode)_keyboardUIMode; 72 #endif 73 @end 74 75 @interface WebView (WebViewMiscInternal) 72 73 - (BOOL)_becomingFirstResponderFromOutside; 74 75 - (void)_registerForIconNotification:(BOOL)listen; 76 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame; 77 78 - (void)_setMouseDownEvent:(NSEvent *)event; 79 - (void)_cancelUpdateMouseoverTimer; 80 - (void)_stopAutoscrollTimer; 81 - (void)_updateMouseoverWithFakeEvent; 82 - (void)_selectionChanged; 83 - (void)_setToolTip:(NSString *)toolTip; 84 85 #if USE(ACCELERATED_COMPOSITING) 86 - (BOOL)_needsOneShotDrawingSynchronization; 87 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization; 88 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame; 89 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame; 90 - (void)_scheduleViewUpdate; 91 #endif 92 93 @end 94 95 #endif 96 97 // FIXME: Temporary way to expose methods that are in the wrong category inside WebView. 98 @interface WebView (WebViewOtherInternal) 76 99 77 100 + (void)_setCacheModel:(WebCacheModel)cacheModel; 78 101 + (WebCacheModel)_cacheModel; 79 - (WebCorePage*)page; 102 103 #ifdef __cplusplus 104 - (WebCore::Page*)page; 105 #endif 106 80 107 - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items; 81 108 - (id)_UIDelegateForwarder; … … 124 151 - (id)_objectForIdentifier:(unsigned long)identifier; 125 152 - (void)_removeObjectForIdentifier:(unsigned long)identifier; 126 - (BOOL)_becomingFirstResponderFromOutside; 127 128 - (void)_registerForIconNotification:(BOOL)listen; 129 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame; 130 131 - (void)_setZoomMultiplier:(float)m isTextOnly:(BOOL)isTextOnly; 153 154 - (void)_setZoomMultiplier:(float)multiplier isTextOnly:(BOOL)isTextOnly; 132 155 - (float)_zoomMultiplier:(BOOL)isTextOnly; 133 156 - (float)_realZoomMultiplier; … … 145 168 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame; 146 169 147 #if USE(ACCELERATED_COMPOSITING)148 - (BOOL)_needsOneShotDrawingSynchronization;149 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;150 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame;151 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame;152 - (void)_scheduleViewUpdate;153 #endif154 155 170 - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard; 156 171 157 172 @end 158 173 159 typedef struct _WebResourceDelegateImplementationCache { 174 #ifdef __cplusplus 175 176 struct WebResourceDelegateImplementationCache { 160 177 IMP didCancelAuthenticationChallengeFunc; 161 178 IMP didReceiveAuthenticationChallengeFunc; … … 170 187 IMP plugInFailedWithErrorFunc; 171 188 IMP shouldUseCredentialStorageFunc; 172 } WebResourceDelegateImplementationCache;173 174 typedef struct _WebFrameLoadDelegateImplementationCache {189 }; 190 191 struct WebFrameLoadDelegateImplementationCache { 175 192 IMP didClearWindowObjectForFrameFunc; 176 193 IMP windowScriptObjectAvailableFunc; … … 191 208 IMP didReceiveIconForFrameFunc; 192 209 IMP didFinishDocumentLoadForFrameFunc; 193 } WebFrameLoadDelegateImplementationCache;194 195 typedef struct _WebScriptDebugDelegateImplementationCache {210 }; 211 212 struct WebScriptDebugDelegateImplementationCache { 196 213 BOOL didParseSourceExpectsBaseLineNumber; 197 214 IMP didParseSourceFunc; … … 201 218 IMP willLeaveCallFrameFunc; 202 219 IMP exceptionWasRaisedFunc; 203 } WebScriptDebugDelegateImplementationCache; 204 205 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView); 206 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *webView); 207 WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *webView); 208 209 #ifdef __cplusplus 220 }; 221 222 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *); 223 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *); 224 WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *); 210 225 211 226 id CallFormDelegate(WebView *, SEL, id, id); -
trunk/WebKit/wx/ChangeLog
r44096 r44379 1 2009-06-02 Darin Adler <darin@apple.com> 2 3 Reviewed by David Hyatt. 4 5 * WebKitSupport/FrameLoaderClientWx.cpp: 6 (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): Use FrameView::create 7 and RefPtr instead of the old "crazy" reference counting. 8 1 9 2009-05-23 David Kilzer <ddkilzer@apple.com> 2 10 -
trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
r43442 r44379 891 891 m_frame->setView(0); 892 892 893 FrameView*frameView;893 RefPtr<FrameView> frameView; 894 894 if (isMainFrame) 895 frameView = new FrameView(m_frame, IntRect(m_webView->GetRect()).size());895 frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size()); 896 896 else 897 frameView = new FrameView(m_frame);897 frameView = FrameView::create(m_frame); 898 898 899 899 ASSERT(frameView); 900 900 m_frame->setView(frameView); 901 frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.902 901 903 902 frameView->setPlatformWidget(m_webView);
Note: See TracChangeset
for help on using the changeset viewer.