summaryrefslogtreecommitdiffstats
path: root/WebCore/page/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/mac')
-rw-r--r--WebCore/page/mac/EventHandlerMac.mm53
-rw-r--r--WebCore/page/mac/FrameMac.mm83
-rw-r--r--WebCore/page/mac/WebDashboardRegion.h51
-rw-r--r--WebCore/page/mac/WebDashboardRegion.m94
4 files changed, 49 insertions, 232 deletions
diff --git a/WebCore/page/mac/EventHandlerMac.mm b/WebCore/page/mac/EventHandlerMac.mm
index bb466db..584f38f 100644
--- a/WebCore/page/mac/EventHandlerMac.mm
+++ b/WebCore/page/mac/EventHandlerMac.mm
@@ -447,14 +447,25 @@ static void selfRetainingNSScrollViewScrollWheel(NSScrollView *self, SEL selecto
[self release];
}
-bool EventHandler::passWheelEventToWidget(PlatformWheelEvent&, Widget* widget)
+bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& wheelEvent, Widget* widget)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- if ([currentNSEvent() type] != NSScrollWheel || m_sendingEventToSubview || !widget)
+
+ if (!widget)
return false;
NSView* nodeView = widget->platformWidget();
+ if (!nodeView) {
+ // WebKit2 code path.
+ if (!widget->isFrameView())
+ return false;
+
+ return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(wheelEvent);
+ }
+
+ if ([currentNSEvent() type] != NSScrollWheel || m_sendingEventToSubview)
+ return false;
+
ASSERT(nodeView);
ASSERT([nodeView superview]);
NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentNSEvent() locationInWindow] fromView:nil]];
@@ -615,19 +626,49 @@ void EventHandler::mouseMoved(NSEvent *event)
END_BLOCK_OBJC_EXCEPTIONS;
}
+static bool frameHasPlatformWidget(Frame* frame)
+{
+ if (FrameView* frameView = frame->view()) {
+ if (frameView->platformWidget())
+ return true;
+ }
+
+ return false;
+}
+
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
{
- return passSubframeEventToSubframe(mev, subframe);
+ // WebKit1 code path.
+ if (frameHasPlatformWidget(m_frame))
+ return passSubframeEventToSubframe(mev, subframe);
+
+ // WebKit2 code path.
+ subframe->eventHandler()->handleMousePressEvent(mev.event());
+ return true;
}
bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
{
- return passSubframeEventToSubframe(mev, subframe, hoveredNode);
+ // WebKit1 code path.
+ if (frameHasPlatformWidget(m_frame))
+ return passSubframeEventToSubframe(mev, subframe, hoveredNode);
+
+ // WebKit2 code path.
+ if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe)
+ return false;
+ subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
+ return true;
}
bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
{
- return passSubframeEventToSubframe(mev, subframe);
+ // WebKit1 code path.
+ if (frameHasPlatformWidget(m_frame))
+ return passSubframeEventToSubframe(mev, subframe);
+
+ // WebKit2 code path.
+ subframe->eventHandler()->handleMouseReleaseEvent(mev.event());
+ return true;
}
PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm
index 510cb96..d4e4098 100644
--- a/WebCore/page/mac/FrameMac.mm
+++ b/WebCore/page/mac/FrameMac.mm
@@ -55,10 +55,6 @@
#import <Carbon/Carbon.h>
#import <wtf/StdLibExtras.h>
-#if ENABLE(DASHBOARD_SUPPORT)
-#import "WebDashboardRegion.h"
-#endif
-
@interface NSView (WebCoreHTMLDocumentView)
- (void)drawSingleRect:(NSRect)rect;
@end
@@ -140,43 +136,6 @@ static RegularExpression* regExpForLabels(NSArray* labels)
return result;
}
-NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
-{
- RenderObject* cellRenderer = cell->renderer();
-
- if (cellRenderer && cellRenderer->isTableCell()) {
- RenderTableCell* tableCellRenderer = toRenderTableCell(cellRenderer);
- RenderTableCell* cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
-
- if (cellAboveRenderer) {
- HTMLTableCellElement* aboveCell =
- static_cast<HTMLTableCellElement*>(cellAboveRenderer->node());
-
- if (aboveCell) {
- // search within the above cell we found for a match
- size_t lengthSearched = 0;
- for (Node* n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
- if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
- // For each text chunk, run the regexp
- String nodeString = n->nodeValue();
- int pos = regExp->searchRev(nodeString);
- if (pos >= 0) {
- if (resultDistanceFromStartOfCell)
- *resultDistanceFromStartOfCell = lengthSearched;
- return nodeString.substring(pos, regExp->matchedLength());
- }
- lengthSearched += nodeString.length();
- }
- }
- }
- }
- }
- // Any reason in practice to search all cells in that are above cell?
- if (resultDistanceFromStartOfCell)
- *resultDistanceFromStartOfCell = notFound;
- return nil;
-}
-
NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element, size_t* resultDistance, bool* resultIsInCellAbove)
{
RegularExpression* regExp = regExpForLabels(labels);
@@ -195,7 +154,7 @@ NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element,
*resultIsInCellAbove = false;
// walk backwards in the node tree, until another element, or form, or end of tree
- int unsigned lengthSearched = 0;
+ unsigned lengthSearched = 0;
Node* n;
for (n = element->traversePreviousNode();
n && lengthSearched < charsSearchedThreshold;
@@ -347,7 +306,7 @@ NSImage* Frame::selectionImage(bool forceBlackText) const
{
m_view->setPaintBehavior(PaintBehaviorSelectionOnly | (forceBlackText ? PaintBehaviorForceBlackText : 0));
m_doc->updateLayout();
- NSImage* result = imageFromRect(selectionBounds());
+ NSImage* result = imageFromRect(selection()->bounds());
m_view->setPaintBehavior(PaintBehaviorNormal);
return result;
}
@@ -395,44 +354,6 @@ DragImageRef Frame::nodeImage(Node* node)
return result;
}
-#if ENABLE(DASHBOARD_SUPPORT)
-NSMutableDictionary* Frame::dashboardRegionsDictionary()
-{
- Document* doc = document();
-
- const Vector<DashboardRegionValue>& regions = doc->dashboardRegions();
- size_t n = regions.size();
-
- // Convert the Vector<DashboardRegionValue> into a NSDictionary of WebDashboardRegions
- NSMutableDictionary* webRegions = [NSMutableDictionary dictionaryWithCapacity:n];
- for (size_t i = 0; i < n; i++) {
- const DashboardRegionValue& region = regions[i];
-
- if (region.type == StyleDashboardRegion::None)
- continue;
-
- NSString *label = region.label;
- WebDashboardRegionType type = WebDashboardRegionTypeNone;
- if (region.type == StyleDashboardRegion::Circle)
- type = WebDashboardRegionTypeCircle;
- else if (region.type == StyleDashboardRegion::Rectangle)
- type = WebDashboardRegionTypeRectangle;
- NSMutableArray *regionValues = [webRegions objectForKey:label];
- if (!regionValues) {
- regionValues = [[NSMutableArray alloc] initWithCapacity:1];
- [webRegions setObject:regionValues forKey:label];
- [regionValues release];
- }
-
- WebDashboardRegion *webRegion = [[WebDashboardRegion alloc] initWithRect:region.bounds clip:region.clip type:type];
- [regionValues addObject:webRegion];
- [webRegion release];
- }
-
- return webRegions;
-}
-#endif
-
DragImageRef Frame::dragImageForSelection()
{
if (!selection()->isRange())
diff --git a/WebCore/page/mac/WebDashboardRegion.h b/WebCore/page/mac/WebDashboardRegion.h
deleted file mode 100644
index 4963d04..0000000
--- a/WebCore/page/mac/WebDashboardRegion.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if !defined(ENABLE_DASHBOARD_SUPPORT)
-#define ENABLE_DASHBOARD_SUPPORT 1
-#endif
-
-#if ENABLE_DASHBOARD_SUPPORT
-
-typedef enum {
- WebDashboardRegionTypeNone,
- WebDashboardRegionTypeCircle,
- WebDashboardRegionTypeRectangle,
- WebDashboardRegionTypeScrollerRectangle
-} WebDashboardRegionType;
-
-@interface WebDashboardRegion : NSObject <NSCopying>
-{
- NSRect rect;
- NSRect clip;
- WebDashboardRegionType type;
-}
-- initWithRect:(NSRect)rect clip:(NSRect)clip type:(WebDashboardRegionType)type;
-- (NSRect)dashboardRegionClip;
-- (NSRect)dashboardRegionRect;
-- (WebDashboardRegionType)dashboardRegionType;
-@end
-
-#endif
diff --git a/WebCore/page/mac/WebDashboardRegion.m b/WebCore/page/mac/WebDashboardRegion.m
deleted file mode 100644
index a6b9872..0000000
--- a/WebCore/page/mac/WebDashboardRegion.m
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2004 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebDashboardRegion.h"
-
-#import <wtf/UnusedParam.h>
-
-#if ENABLE(DASHBOARD_SUPPORT)
-
-@implementation WebDashboardRegion
-
-- initWithRect:(NSRect)r clip:(NSRect)c type:(WebDashboardRegionType)t
-{
- self = [super init];
- rect = r;
- clip = c;
- type = t;
- return self;
-}
-
-- (id)copyWithZone:(NSZone *)unusedZone
-{
- UNUSED_PARAM(unusedZone);
-
- return [self retain];
-}
-
-- (NSRect)dashboardRegionClip
-{
- return clip;
-}
-
-- (NSRect)dashboardRegionRect
-{
- return rect;
-}
-
-- (WebDashboardRegionType)dashboardRegionType
-{
- return type;
-}
-
-static const char* typeName(WebDashboardRegionType type)
-{
- switch (type) {
- case WebDashboardRegionTypeNone:
- return "None";
- case WebDashboardRegionTypeCircle:
- return "Circle";
- case WebDashboardRegionTypeRectangle:
- return "Rectangle";
- case WebDashboardRegionTypeScrollerRectangle:
- return "ScrollerRectangle";
- }
- return "Unknown";
-}
-
-- (NSString *)description
-{
- return [NSString stringWithFormat:@"rect:%@ clip:%@ type:%s", NSStringFromRect(rect), NSStringFromRect(clip), typeName(type)];
-}
-
-// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into a NSSet or is the key in an NSDictionary.
-- (BOOL)isEqual:(id)other
-{
- return NSEqualRects(rect, [other dashboardRegionRect]) && NSEqualRects(clip, [other dashboardRegionClip]) && type == [other dashboardRegionType];
-}
-
-@end
-
-#endif