+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * platform/mac/plugins/supports-carbon-event-model-expected.txt: Removed.
+ * platform/mac/plugins/supports-carbon-event-model.html: Removed.
+
2019-03-02 Zalan Bujtas <zalan@apple.com>
[ContentChangeObserver] Introduce ContentChangeObserver::adjustObservedState
+++ /dev/null
-
-This tests that WebKit correctly reports that the Carbon event model is supported.
-SUCCESS!
+++ /dev/null
-<script src="../../../resources/plugin.js"></script>
-<script>
- if (window.testRunner)
- testRunner.dumpAsText();
-
- runAfterPluginLoad(null, NotifyDone);
-</script>
-
-<embed id="testPlugin"
- type="application/x-webkit-test-netscape"
- test="supports-carbon-event-model">
-</embed>
-
-<div>
- This tests that WebKit correctly reports that the Carbon event model is supported.
-</div>
-<div id="result">FAILURE</div>
-</body>
-</html>
+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * platform/gamepad/cocoa/GameControllerGamepad.h:
+ * platform/gamepad/cocoa/GameControllerGamepad.mm:
+ * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
+ * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ * platform/mac/PlatformEventFactoryMac.mm:
+ (WebCore::globalPointForEvent):
+ (WebCore::pointForEvent):
+ (WebCore::mouseButtonForEvent):
+ (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::servicesRolloverButtonCell const):
+ (WebCore::RenderThemeMac::paintImageControlsButton):
+ (WebCore::RenderThemeMac::imageControlsButtonSize const):
+ (WebCore::RenderThemeMac::imageControlsButtonPositionOffset const):
+
2019-03-02 Zalan Bujtas <zalan@apple.com>
[ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/PlatformMac.cmake:
+ * pal/spi/cocoa/IOKitSPI.h:
+ * pal/spi/mac/QuickDrawSPI.h: Removed.
+
2019-03-01 Justin Fan <justin_fan@apple.com>
[Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; };
7A3A6A8020CADB4700317AAE /* NSImageSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */; };
A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; };
- A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658A1F56748C00B4C844 /* QuickDrawSPI.h */; };
A102658E1F567E9D00B4C844 /* HIServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658D1F567E9D00B4C844 /* HIServicesSPI.h */; };
A10826F11F573BCA004772AC /* NSResponderSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10826F01F573BCA004772AC /* NSResponderSPI.h */; };
A10826F91F576292004772AC /* WebPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = A10826F71F576292004772AC /* WebPanel.h */; };
7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSImageSPI.h; sourceTree = "<group>"; };
93E5909C1F93BF1E0067F8CF /* UnencodableHandling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnencodableHandling.h; sourceTree = "<group>"; };
A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; };
- A102658A1F56748C00B4C844 /* QuickDrawSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickDrawSPI.h; sourceTree = "<group>"; };
A102658D1F567E9D00B4C844 /* HIServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HIServicesSPI.h; sourceTree = "<group>"; };
A10826F01F573BCA004772AC /* NSResponderSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSResponderSPI.h; sourceTree = "<group>"; };
A10826F71F576292004772AC /* WebPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPanel.h; sourceTree = "<group>"; };
0C7785841F45130F00F4EBB6 /* NSWindowSPI.h */,
0C7785851F45130F00F4EBB6 /* PIPSPI.h */,
0C7785861F45130F00F4EBB6 /* QTKitSPI.h */,
- A102658A1F56748C00B4C844 /* QuickDrawSPI.h */,
0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,
0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */,
0C2DA1561F3BEB4900DBC317 /* pthreadSPI.h in Headers */,
0C77859F1F45130F00F4EBB6 /* QTKitSPI.h in Headers */,
0C2DA1571F3BEB4900DBC317 /* QuartzCoreSPI.h in Headers */,
- A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */,
0C7785A01F45130F00F4EBB6 /* QuickLookMacSPI.h in Headers */,
4450FCA021F5F602004DFA56 /* QuickLookSoftLink.h in Headers */,
0C5AF9201F43A4C7002EAC02 /* QuickLookSPI.h in Headers */,
spi/mac/NSWindowSPI.h
spi/mac/PIPSPI.h
spi/mac/QTKitSPI.h
- spi/mac/QuickDrawSPI.h
spi/mac/QuickLookMacSPI.h
spi/mac/SpeechSynthesisSPI.h
spi/mac/TelephonyUtilitiesSPI.h
WTF_EXTERN_C_BEGIN
-#ifdef __LP64__
typedef double IOHIDFloat;
-#else
-typedef float IOHIDFloat;
-#endif
enum {
kIOHIDEventOptionNone = 0,
+++ /dev/null
-/*
- * Copyright (C) 2010-2017 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 INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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.
- */
-
-#pragma once
-
-#ifndef __LP64__
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#include <ApplicationServices/ApplicationServicesPriv.h>
-
-#else
-
-#define MacSetRect SetRect
-#define MacSetRectRgn SetRectRgn
-#define MacUnionRgn UnionRgn
-
-enum {
- blackColor = 33,
- whiteColor = 30,
- greenColor = 341,
-};
-
-enum {
- kBitsProc = 8,
-};
-
-#endif
-
-typedef long QDDrawingType;
-
-WTF_EXTERN_C_BEGIN
-
-Boolean EmptyRgn(RgnHandle);
-OSStatus CreateCGContextForPort(CGrafPtr, CGContextRef*);
-OSStatus SyncCGContextOriginWithPort(CGContextRef, CGrafPtr);
-PixMapHandle GetPortPixMap(CGrafPtr);
-QDErr NewGWorldFromPtr(GWorldPtr*, UInt32, const Rect*, CTabHandle, GDHandle, GWorldFlags, Ptr, SInt32);
-Rect* GetPortBounds(CGrafPtr, Rect*);
-Rect* GetRegionBounds(RgnHandle, Rect*);
-RgnHandle GetPortClipRegion(CGrafPtr, RgnHandle);
-RgnHandle GetPortVisibleRegion(CGrafPtr, RgnHandle);
-RgnHandle NewRgn(void);
-void BackColor(long);
-void CallDrawingNotifications(CGrafPtr, const Rect*, QDDrawingType);
-void DisposeGWorld(GWorldPtr);
-void DisposeRgn(RgnHandle);
-void ForeColor(long);
-void GetGWorld(CGrafPtr*, GDHandle*);
-void GetPort(GrafPtr*);
-void GlobalToLocal(Point*);
-void MacSetRect(Rect*, short, short, short, short);
-void MacSetRectRgn(RgnHandle, short, short, short, short);
-void MacUnionRgn(RgnHandle, RgnHandle, RgnHandle);
-void MovePortTo(short, short);
-void OffsetRect(Rect*, short, short);
-void OffsetRgn(RgnHandle, short, short);
-void PaintRect(const Rect*);
-void PenNormal(void);
-void PortSize(short, short);
-void RectRgn(RgnHandle, const Rect*);
-void SectRgn(RgnHandle, RgnHandle, RgnHandle);
-void SetGWorld(CGrafPtr, GDHandle);
-void SetOrigin(short, short);
-void SetPort(GrafPtr);
-void SetPortClipRegion(CGrafPtr, RgnHandle);
-void SetPortVisibleRegion(CGrafPtr, RgnHandle);
-
-WTF_EXTERN_C_END
-
-#endif
#pragma once
-#if ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#if ENABLE(GAMEPAD)
#include "PlatformGamepad.h"
#include <wtf/RetainPtr.h>
} // namespace WebCore
-#endif // ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#endif // ENABLE(GAMEPAD)
#include "config.h"
#include "GameControllerGamepad.h"
-#if ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#if ENABLE(GAMEPAD)
#include "GameControllerGamepadProvider.h"
#include <GameController/GameController.h>
} // namespace WebCore
-#endif // ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#endif // ENABLE(GAMEPAD)
#pragma once
-#if ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#if ENABLE(GAMEPAD)
#include "GamepadProvider.h"
#include <wtf/HashMap.h>
} // namespace WebCore
-#endif // ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#endif // ENABLE(GAMEPAD)
#import "config.h"
#import "GameControllerGamepadProvider.h"
-#if ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#if ENABLE(GAMEPAD)
#import "GameControllerGamepad.h"
#import "GamepadProviderClient.h"
} // namespace WebCore
-#endif // ENABLE(GAMEPAD) && (defined(__LP64__) || PLATFORM(IOS_FAMILY))
+#endif // ENABLE(GAMEPAD)
SOFT_LINK_CLASS(CoreUI, CUIStyleEffectConfiguration)
#endif
-#ifdef __LP64__
-#define URefCon void*
-#else
-#define URefCon UInt32
-#endif
-
namespace WebCore {
// Confusingly, even when CGFontRenderingGetFontSmoothingDisabled() returns true, CGContextSetShouldSmoothFonts() still impacts text
static NSPoint globalPointForEvent(NSEvent *event)
{
switch ([event type]) {
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseDragged:
case NSEventTypeLeftMouseUp:
static IntPoint pointForEvent(NSEvent *event, NSView *windowView)
{
switch ([event type]) {
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseDragged:
case NSEventTypeLeftMouseUp:
static MouseButton mouseButtonForEvent(NSEvent *event)
{
switch ([event type]) {
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp:
case NSEventTypeLeftMouseDragged:
// PlatformEvent
m_type = mouseEventTypeForEvent(event);
-#if defined(__LP64__)
BOOL eventIsPressureEvent = [event type] == NSEventTypePressure;
if (eventIsPressureEvent) {
// Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure
else
m_type = PlatformEvent::MouseForceChanged;
}
-#else
- UNUSED_PARAM(correspondingPressureEvent);
-#endif
m_modifiers = modifiersForEvent(event);
m_timestamp = eventTimeStampSince1970(event);
#endif
m_force = 0;
-#if defined(__LP64__)
int stage = eventIsPressureEvent ? event.stage : correspondingPressureEvent.stage;
double pressure = eventIsPressureEvent ? event.pressure : correspondingPressureEvent.pressure;
m_force = pressure + stage;
-#endif
// Mac specific
m_modifierFlags = [event modifierFlags];
#import "HTMLMeterElement.h"
#endif
-#if defined(__LP64__) && __LP64__
-#define HAVE_APPKIT_SERVICE_CONTROLS_SUPPORT 1
-#else
-#define HAVE_APPKIT_SERVICE_CONTROLS_SUPPORT 0
-#endif
-
-#if ENABLE(SERVICE_CONTROLS) && HAVE(APPKIT_SERVICE_CONTROLS_SUPPORT)
+#if ENABLE(SERVICE_CONTROLS)
// FIXME: This should go into an SPI.h file in the spi directory.
#if USE(APPLE_INTERNAL_SDK)
#if ENABLE(SERVICE_CONTROLS)
NSServicesRolloverButtonCell* RenderThemeMac::servicesRolloverButtonCell() const
{
-#if HAVE(APPKIT_SERVICE_CONTROLS_SUPPORT)
if (!m_servicesRolloverButton) {
m_servicesRolloverButton = [NSServicesRolloverButtonCell serviceRolloverButtonCellForStyle:NSSharingServicePickerStyleRollover];
[m_servicesRolloverButton setBezelStyle:NSBezelStyleRoundedDisclosure];
}
return m_servicesRolloverButton.get();
-#else
- return nil;
-#endif
}
bool RenderThemeMac::paintImageControlsButton(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect)
if (paintInfo.phase != PaintPhase::BlockBackground)
return true;
-#if HAVE(APPKIT_SERVICE_CONTROLS_SUPPORT)
NSServicesRolloverButtonCell *cell = servicesRolloverButtonCell();
LocalCurrentGraphicsContext localContext(paintInfo.context());
IntRect innerFrame(IntPoint(), rect.size());
[cell drawWithFrame:innerFrame inView:documentViewFor(renderer)];
[cell setControlView:nil];
-#else
- UNUSED_PARAM(renderer);
- UNUSED_PARAM(rect);
-#endif
return true;
}
IntSize RenderThemeMac::imageControlsButtonSize(const RenderObject&) const
{
-#if HAVE(APPKIT_SERVICE_CONTROLS_SUPPORT)
return IntSize(servicesRolloverButtonCell().cellSize);
-#else
- return IntSize();
-#endif
}
IntSize RenderThemeMac::imageControlsButtonPositionOffset() const
{
-#if HAVE(APPKIT_SERVICE_CONTROLS_SUPPORT)
// FIXME: Currently the offsets will always be the same no matter what image rect you try with.
// This may not always be true in the future.
static const int dummyDimension = 100;
NSRect bounds = [servicesRolloverButtonCell() rectForBounds:dummyImageRect preferredEdge:NSMinYEdge];
return IntSize(dummyDimension - bounds.origin.x, bounds.origin.y);
-#else
- return IntSize();
-#endif
}
#endif
+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * Platform/Module.cpp:
+ (WebKit::Module::Module):
+ * Platform/Module.h:
+ * Platform/cf/ModuleCF.cpp:
+ (WebKit::Module::unload):
+ (WebKit::Module::bundleResourceMap): Deleted.
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::initializeShim):
+ (WebKit::PluginProcess::platformInitializeProcess):
+ (WebKit::shouldCallRealDebugger): Deleted.
+ (WebKit::isWindowActive): Deleted.
+ (WebKit::getCurrentEventButtonState): Deleted.
+ (WebKit::carbonWindowShown): Deleted.
+ (WebKit::carbonWindowHidden): Deleted.
+ (WebKit::openCFURLRef): Deleted.
+ (WebKit::isMallocTinyMemoryTag): Deleted.
+ (WebKit::shouldMapMemoryExecutable): Deleted.
+ * PluginProcess/mac/PluginProcessShim.h:
+ * PluginProcess/mac/PluginProcessShim.mm:
+ (WebKit::shimDebugger): Deleted.
+ (WebKit::shimGetCurrentEventButtonState): Deleted.
+ (WebKit::shimIsWindowActive): Deleted.
+ (WebKit::shimModalDialog): Deleted.
+ (WebKit::shimAlert): Deleted.
+ (WebKit::shimShowWindow): Deleted.
+ (WebKit::shimHideWindow): Deleted.
+ (WebKit::shimLSOpenCFURLRef): Deleted.
+ (WebKit::shimMachVMMap): Deleted.
+ * Shared/API/Cocoa/WKFoundation.h:
+ * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+ (WebKit::XPCServiceMain):
+ * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
+ (WebKit::NetscapePluginModule::tryLoad):
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::getPluginArchitecture):
+ (WebKit::NetscapePluginModule::determineQuirks):
+ * Shared/Plugins/PluginQuirks.h:
+ * Shared/cf/ArgumentCodersCF.cpp:
+ (IPC::sizeForNumberType):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::mouseButtonForEvent):
+ (WebKit::globalPointForEvent):
+ (WebKit::pointForEvent):
+ (WebKit::WebEventFactory::createWebMouseEvent):
+ * UIProcess/API/C/mac/WKPagePrivateMac.h:
+ * UIProcess/API/C/mac/WKPagePrivateMac.mm:
+ (WKPageLoadFileReturningNavigation):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::pressureChangeWithEvent):
+ * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
+ (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
+ * UIProcess/mac/ServicesController.mm:
+ (WebKit::ServicesController::ServicesController):
+ * UIProcess/mac/WebContextMenuProxyMac.mm:
+ (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_GetValue):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::NetscapePlugin):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ (WebKit::NetscapePlugin::isWindowActive const): Deleted.
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::setDrawingModel):
+ (WebKit::NetscapePlugin::setEventModel):
+ (WebKit::NetscapePlugin::platformPostInitialize):
+ (WebKit::NetscapePlugin::platformDestroy):
+ (WebKit::NetscapePlugin::platformGeometryDidChange):
+ (WebKit::NetscapePlugin::platformPaint):
+ (WebKit::NetscapePlugin::platformHandleMouseEvent):
+ (WebKit::NetscapePlugin::platformHandleWheelEvent):
+ (WebKit::NetscapePlugin::platformHandleMouseEnterEvent):
+ (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent):
+ (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
+ (WebKit::NetscapePlugin::platformSetFocus):
+ (WebKit::NetscapePlugin::windowFocusChanged):
+ (WebKit::NetscapePlugin::windowAndViewFramesChanged):
+ (WebKit::NetscapePlugin::sendComplexTextInput):
+ (): Deleted.
+ (WebKit::windowMap): Deleted.
+ (WebKit::NetscapePlugin::netscapePluginFromWindow): Deleted.
+ (WebKit::NetscapePlugin::windowRef const): Deleted.
+ (WebKit::NetscapePlugin::updateFakeWindowBounds): Deleted.
+ (WebKit::NetscapePlugin::buttonState): Deleted.
+ (WebKit::initializeEventRecord): Deleted.
+ (WebKit::anyMouseButtonIsDown): Deleted.
+ (WebKit::rightMouseButtonIsDown): Deleted.
+ (WebKit::modifiersForEvent): Deleted.
+ (WebKit::convertStringToKeyCodes): Deleted.
+ (WebKit::scriptCodeFromCurrentKeyboardInputSource): Deleted.
+ (WebKit::NetscapePlugin::nullEventTimerFired): Deleted.
+
2019-03-02 Zalan Bujtas <zalan@apple.com>
[ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
Module::Module(const String& path)
: m_path(path)
-#if USE(CF) && !defined(__LP64__)
- , m_bundleResourceMap(-1)
-#endif
{
}
template<typename FunctionType> FunctionType functionPointer(const char* functionName) const;
-#if USE(CF) && !defined(__LP64__)
- CFBundleRefNum bundleResourceMap();
-#endif
-
private:
void* platformFunctionPointer(const char* functionName) const;
#endif
#if USE(CF)
RetainPtr<CFBundleRef> m_bundle;
-#if !defined(__LP64__)
- CFBundleRefNum m_bundleResourceMap;
-#endif
#elif USE(GLIB)
GModule* m_handle;
#endif
if (!m_bundle)
return;
-#if !defined(__LP64__)
- if (m_bundleResourceMap != -1)
- CFBundleCloseBundleResourceMap(m_bundle.get(), m_bundleResourceMap);
-#endif
-
// See the comment in Module.h for why we leak the bundle here.
CFBundleRef unused = m_bundle.leakRef();
(void)unused;
return CFBundleGetIdentifier(m_bundle.get());
}
-#if !defined(__LP64__)
-CFBundleRefNum Module::bundleResourceMap()
-{
- if (m_bundleResourceMap == -1)
- m_bundleResourceMap = CFBundleOpenBundleResourceMap(m_bundle.get());
-
- return m_bundleResourceMap;
-}
-#endif
-
}
return NO;
}
-#ifndef NP_NO_CARBON
-static bool windowCoversAnyScreen(WindowRef window)
-{
- HIRect bounds;
- HIWindowGetBounds(window, kWindowStructureRgn, kHICoordSpaceScreenPixel, &bounds);
-
- // Convert to Cocoa-style screen coordinates that use a Y offset relative to the zeroth screen's origin.
- bounds.origin.y = NSHeight([(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame]) - CGRectGetMaxY(bounds);
-
- return rectCoversAnyScreen(NSRectFromCGRect(bounds));
-}
-
-static CGWindowID cgWindowID(WindowRef window)
-{
- return reinterpret_cast<CGWindowID>(GetNativeWindowFromWindowRef(window));
-}
-
-#endif
-
static bool windowCoversAnyScreen(NSWindow *window)
{
return rectCoversAnyScreen(window.frame);
return fullscreenWindowTracker;
}
-#if defined(__i386__)
-
-static bool shouldCallRealDebugger()
-{
- static bool isUserbreakSet = false;
- static dispatch_once_t flag;
- dispatch_once(&flag, ^{
- char* var = getenv("USERBREAK");
-
- if (var)
- isUserbreakSet = atoi(var);
- });
-
- return isUserbreakSet;
-}
-
-static bool isWindowActive(WindowRef windowRef, bool& result)
-{
-#ifndef NP_NO_CARBON
- if (NetscapePlugin* plugin = NetscapePlugin::netscapePluginFromWindow(windowRef)) {
- result = plugin->isWindowActive();
- return true;
- }
-#endif
- return false;
-}
-
-static UInt32 getCurrentEventButtonState()
-{
-#ifndef NP_NO_CARBON
- return NetscapePlugin::buttonState();
-#else
- ASSERT_NOT_REACHED();
- return 0;
-#endif
-}
-
-static void carbonWindowShown(WindowRef window)
-{
-#ifndef NP_NO_CARBON
- fullscreenWindowTracker().windowShown(window);
-#endif
-}
-
-static void carbonWindowHidden(WindowRef window)
-{
-#ifndef NP_NO_CARBON
- fullscreenWindowTracker().windowHidden(window);
-#endif
-}
-
-static bool openCFURLRef(CFURLRef url, int32_t& status, CFURLRef* launchedURL)
-{
- String launchedURLString;
- if (!PluginProcess::singleton().openURL(URL(url).string(), status, launchedURLString))
- return false;
-
- if (!launchedURLString.isNull() && launchedURL)
- *launchedURL = URL(URL(), launchedURLString).createCFURL().leakRef();
- return true;
-}
-
-static bool isMallocTinyMemoryTag(int tag)
-{
- switch (tag) {
- case VM_MEMORY_MALLOC_TINY:
- return true;
-
- default:
- return false;
- }
-}
-
-static bool shouldMapMallocMemoryExecutable;
-
-static bool shouldMapMemoryExecutable(int flags)
-{
- if (!shouldMapMallocMemoryExecutable)
- return false;
-
- if (!isMallocTinyMemoryTag((flags >> 24) & 0xff))
- return false;
-
- return true;
-}
-
-#endif
-
static void setModal(bool modalWindowIsShowing)
{
PluginProcess::singleton().setModalWindowIsShowing(modalWindowIsShowing);
{
// Initialize the shim for 32-bit only.
const PluginProcessShimCallbacks callbacks = {
-#if defined(__i386__)
- shouldCallRealDebugger,
- isWindowActive,
- getCurrentEventButtonState,
- beginModal,
- endModal,
- carbonWindowShown,
- carbonWindowHidden,
- setModal,
- openCFURLRef,
- shouldMapMemoryExecutable,
-#endif
stringCompare,
};
if (m_pluginBundleIdentifier == "com.adobe.acrobat.pdfviewerNPAPI")
oldPluginProcessNameShouldEqualNewPluginProcessNameForAdobeReader = true;
-#if defined(__i386__)
- if (m_pluginBundleIdentifier == "com.microsoft.SilverlightPlugin") {
- // Set this so that any calls to mach_vm_map for pages reserved by malloc will be executable.
- shouldMapMallocMemoryExecutable = true;
-
- // Go through the address space looking for already existing malloc regions and change the
- // protection to make them executable.
- mach_vm_size_t size;
- uint32_t depth = 0;
- struct vm_region_submap_info_64 info = { };
- mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
- for (mach_vm_address_t addr = 0; ; addr += size) {
- kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &count);
- if (kr != KERN_SUCCESS)
- break;
-
- if (isMallocTinyMemoryTag(info.user_tag))
- mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
- }
-
- // Silverlight expects the data segment of its coreclr library to be executable.
- // Register with dyld to get notified when libraries are bound, then look for the
- // coreclr image and make its __DATA segment executable.
- _dyld_register_func_for_add_image([](const struct mach_header* mh, intptr_t vmaddr_slide) {
- Dl_info imageInfo;
- if (!dladdr(mh, &imageInfo))
- return;
-
- const char* pathSuffix = "/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr";
-
- int pathSuffixLength = strlen(pathSuffix);
- int imageFilePathLength = strlen(imageInfo.dli_fname);
-
- if (imageFilePathLength < pathSuffixLength)
- return;
-
- if (strcmp(imageInfo.dli_fname + (imageFilePathLength - pathSuffixLength), pathSuffix))
- return;
-
- unsigned long segmentSize;
- const uint8_t* segmentData = getsegmentdata(mh, "__DATA", &segmentSize);
- if (!segmentData)
- return;
-
- mach_vm_size_t size;
- uint32_t depth = 0;
- struct vm_region_submap_info_64 info = { };
- mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
- for (mach_vm_address_t addr = reinterpret_cast<mach_vm_address_t>(segmentData); addr < reinterpret_cast<mach_vm_address_t>(segmentData) + segmentSize ; addr += size) {
- kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &count);
- if (kr != KERN_SUCCESS)
- break;
-
- mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
- }
- });
- }
-#endif
-
// FIXME: Workaround for Java not liking its plugin process to be suppressed - <rdar://problem/14267843>
if (m_pluginBundleIdentifier == "com.oracle.java.JavaAppletPlugin")
(new UserActivity("com.oracle.java.JavaAppletPlugin"))->start();
namespace WebKit {
struct PluginProcessShimCallbacks {
-#if defined(__i386__)
- bool (*shouldCallRealDebugger)();
- bool (*isWindowActive)(WindowRef, bool& result);
- UInt32 (*getCurrentEventButtonState)();
- void (*beginModal)();
- void (*endModal)();
- void (*carbonWindowShown)(WindowRef);
- void (*carbonWindowHidden)(WindowRef);
- void (*setModal)(bool);
- bool (*openCFURLRef)(CFURLRef, int32_t& returnValue, CFURLRef* launchedURL);
- bool (*shouldMapMemoryExecutable)(int flags);
-#endif
bool (*stringCompare)(CFStringRef a, CFStringRef b, CFStringCompareFlags options, void* returnAddress, CFComparisonResult& result);
};
static PluginProcessShimCallbacks pluginProcessShimCallbacks;
-#ifndef __LP64__
-
-ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-
-static void shimDebugger(void)
-{
- if (!pluginProcessShimCallbacks.shouldCallRealDebugger())
- return;
-
- Debugger();
-}
-
-static UInt32 shimGetCurrentEventButtonState()
-{
- return pluginProcessShimCallbacks.getCurrentEventButtonState();
-}
-
-static Boolean shimIsWindowActive(WindowRef window)
-{
- bool result;
- if (pluginProcessShimCallbacks.isWindowActive(window, result))
- return result;
-
- return IsWindowActive(window);
-}
-
-static void shimModalDialog(ModalFilterUPP modalFilter, DialogItemIndex *itemHit)
-{
- pluginProcessShimCallbacks.beginModal();
- ModalDialog(modalFilter, itemHit);
- pluginProcessShimCallbacks.endModal();
-}
-
-static DialogItemIndex shimAlert(SInt16 alertID, ModalFilterUPP modalFilter)
-{
- pluginProcessShimCallbacks.beginModal();
- DialogItemIndex index = Alert(alertID, modalFilter);
- pluginProcessShimCallbacks.endModal();
-
- return index;
-}
-
-static void shimShowWindow(WindowRef window)
-{
- pluginProcessShimCallbacks.carbonWindowShown(window);
- ShowWindow(window);
-}
-
-static void shimHideWindow(WindowRef window)
-{
- pluginProcessShimCallbacks.carbonWindowHidden(window);
- HideWindow(window);
-}
-
-static OSStatus
-shimLSOpenCFURLRef(CFURLRef url, CFURLRef* launchedURL)
-{
- int32_t returnValue;
- if (pluginProcessShimCallbacks.openCFURLRef(url, returnValue, launchedURL))
- return returnValue;
-
- return LSOpenCFURLRef(url, launchedURL);
-}
-
-static kern_return_t shimMachVMMap(vm_map_t task, mach_vm_address_t *address, mach_vm_size_t size, mach_vm_offset_t mask, int flags, mem_entry_name_port_t object, memory_object_offset_t offset, boolean_t copy, vm_prot_t currentProtection, vm_prot_t maxProtection, vm_inherit_t inheritance)
-{
- if (task == mach_task_self()) {
- if (pluginProcessShimCallbacks.shouldMapMemoryExecutable && pluginProcessShimCallbacks.shouldMapMemoryExecutable(flags)) {
- currentProtection |= VM_PROT_EXECUTE;
- maxProtection |= VM_PROT_EXECUTE;
- }
- }
-
- return mach_vm_map(task, address, size, mask, flags, object, offset, copy, currentProtection, maxProtection, inheritance);
-}
-
-DYLD_INTERPOSE(shimDebugger, Debugger);
-DYLD_INTERPOSE(shimGetCurrentEventButtonState, GetCurrentEventButtonState);
-DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive);
-DYLD_INTERPOSE(shimModalDialog, ModalDialog);
-DYLD_INTERPOSE(shimAlert, Alert);
-DYLD_INTERPOSE(shimShowWindow, ShowWindow);
-DYLD_INTERPOSE(shimHideWindow, HideWindow);
-DYLD_INTERPOSE(shimLSOpenCFURLRef, LSOpenCFURLRef);
-DYLD_INTERPOSE(shimMachVMMap, mach_vm_map);
-
-ALLOW_DEPRECATED_DECLARATIONS_END
-
-#endif
-
// Simple Fake System V shared memory. This replacement API implements
// usable system V shared memory for use within a single process. The memory
// is not shared outside of the scope of the process.
#import <TargetConditionals.h>
#if !defined(WK_API_ENABLED)
-#if TARGET_OS_IPHONE || (defined(__clang__) && defined(__APPLE__) && !defined(__i386__))
#define WK_API_ENABLED 1
-#else
-#define WK_API_ENABLED 0
-#endif
#endif
#ifdef __cplusplus
int XPCServiceMain(int, const char**)
{
-#if defined(__i386__)
- // FIXME: This should only be done for the 32-bit plug-in XPC service so we rely on the fact that
- // it's the only of the XPC services that are 32-bit. We should come up with a more targeted #if check.
- @autoreleasepool {
- // We must set the state of AppleMagnifiedMode before NSApplication initialization so that the value will be in
- // place before Cocoa startup logic runs and caches the value.
- [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"AppleMagnifiedMode" : @YES }];
- }
-#endif
-
auto bootstrap = adoptOSObject(xpc_copy_bootstrap());
#if PLATFORM(IOS_FAMILY)
auto containerEnvironmentVariables = xpc_dictionary_get_value(bootstrap.get(), "ContainerEnvironmentVariables");
// reversed. Failing to follow this order results in crashes (e.g., in Silverlight on Mac and
// in Flash and QuickTime on Windows).
#if PLUGIN_ARCHITECTURE(MAC)
-#ifndef NP_NO_CARBON
-
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-
- // Plugins (at least QT) require that you call UseResFile on the resource file before loading it.
- ResFileRefNum currentResourceFile = CurResFile();
-
- ResFileRefNum pluginResourceFile = m_module->bundleResourceMap();
- UseResFile(pluginResourceFile);
-
-#endif
- bool result = initializeFuncPtr(netscapeBrowserFuncs()) == NPERR_NO_ERROR && getEntryPointsFuncPtr(&m_pluginFuncs) == NPERR_NO_ERROR;
-
-#ifndef NP_NO_CARBON
- // Restore the resource file.
- UseResFile(currentResourceFile);
-
- ALLOW_DEPRECATED_DECLARATIONS_END
-
-#endif
-
- return result;
+ return initializeFuncPtr(netscapeBrowserFuncs()) == NPERR_NO_ERROR && getEntryPointsFuncPtr(&m_pluginFuncs) == NPERR_NO_ERROR;
#elif PLUGIN_ARCHITECTURE(UNIX)
if (initializeFuncPtr(netscapeBrowserFuncs(), &m_pluginFuncs) != NPERR_NO_ERROR)
return false;
plugin.pluginArchitecture = CPU_TYPE_X86;
return true;
}
-#elif defined(__i386__)
- // We only support 32-bit Intel plug-ins on 32-bit Intel.
- if (architectures.contains(kCFBundleExecutableArchitectureI386)) {
- plugin.pluginArchitecture = CPU_TYPE_X86;
- return true;
- }
#endif
return false;
// understand the parameter names specified in the <object> element that
// embeds its plug-in.
m_pluginQuirks.add(PluginQuirks::WantsLowercaseParameterNames);
-
-#ifndef NP_NO_QUICKDRAW
- // The AppleConnect plug-in uses QuickDraw but doesn't paint or receive events
- // so we'll allow it to be instantiated even though we don't support QuickDraw.
- m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport);
-#endif
}
-#ifndef NP_NO_QUICKDRAW
- if (plugin.bundleIdentifier == "com.microsoft.sharepoint.browserplugin") {
- // The Microsoft SharePoint plug-in uses QuickDraw but doesn't paint or receive events
- // so we'll allow it to be instantiated even though we don't support QuickDraw.
- m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport);
- }
-
- if (plugin.bundleIdentifier == "com.jattesaker.macid2.NPPlugin") {
- // The BankID plug-in uses QuickDraw but doesn't paint or receive events
- // so we'll allow it to be instantiated even though we don't support QuickDraw.
- m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport);
- }
-#endif
-
if (plugin.bundleIdentifier == "com.adobe.acrobat.pdfviewerNPAPI" || plugin.bundleIdentifier == "com.apple.testnetscapeplugin") {
// The Adobe Reader plug-in wants wheel events.
m_pluginQuirks.add(PluginQuirks::WantsWheelEvents);
// <rdar://problem/13003470> Adobe Flash has a bug where exceptions are released too early.
LeakAllThrownNSExceptions,
-#ifndef NP_NO_QUICKDRAW
- // Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
- // will never paint or receive events. Used by the AppleConnect plug-in.
- AllowHalfBakedQuickDrawSupport,
-#endif
-
// X11 specific quirks:
#elif PLATFORM(X11)
// Flash and npwrapper ask the browser about which GTK version does it use
#include <wtf/FileSystem.h>
namespace WebKit {
-using namespace WebCore;
Vector<String> pluginsDirectories()
{
case kCFNumberCFIndexType:
return sizeof(CFIndex);
case kCFNumberNSIntegerType:
-#ifdef __LP64__
return sizeof(long);
-#else
- return sizeof(int);
-#endif
case kCFNumberCGFloatType:
-#ifdef __LP64__
return sizeof(double);
-#else
- return sizeof(float);
-#endif
}
return 0;
case NSEventTypeOtherMouseUp:
case NSEventTypeOtherMouseDragged:
return WebMouseEvent::MiddleButton;
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeMouseEntered:
case NSEventTypeMouseExited:
return currentMouseButton();
static NSPoint globalPointForEvent(NSEvent *event)
{
switch ([event type]) {
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp:
case NSEventTypeLeftMouseDragged:
static NSPoint pointForEvent(NSEvent *event, NSView *windowView)
{
switch ([event type]) {
-#if defined(__LP64__)
case NSEventTypePressure:
-#endif
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp:
case NSEventTypeLeftMouseDragged:
NSPoint globalPosition = globalPointForEvent(event);
WebEvent::Type type = mouseEventTypeForEvent(event);
-#if defined(__LP64__)
if ([event type] == NSEventTypePressure) {
// Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure
// event and lastPressureEvent to detect if this is MouseForceDown, MouseForceUp, or just MouseForceChanged.
else
type = WebEvent::MouseForceChanged;
}
-#endif
WebMouseEvent::Button button = mouseButtonForEvent(event);
unsigned short buttons = currentlyPressedMouseButtons();
int eventNumber = [event eventNumber];
int menuTypeForEvent = typeForEvent(event);
- double force = 0;
-#if defined(__LP64__)
int stage = [event type] == NSEventTypePressure ? event.stage : lastPressureEvent.stage;
double pressure = [event type] == NSEventTypePressure ? event.pressure : lastPressureEvent.pressure;
- force = pressure + stage;
-#endif
+ double force = pressure + stage;
return WebMouseEvent(type, button, buttons, WebCore::IntPoint(position), WebCore::IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
}
WK_EXPORT void WKPageSetFullscreenDelegate(WKPageRef page, id <_WKFullscreenDelegate>);
WK_EXPORT id <_WKFullscreenDelegate> WKPageGetFullscreenDelegate(WKPageRef page);
-#if !TARGET_OS_IPHONE && (defined(__clang__) && defined(__APPLE__) && !defined(__i386__))
@class WKNavigation;
WK_EXPORT WKNavigation *WKPageLoadURLRequestReturningNavigation(WKPageRef page, WKURLRequestRef request);
WK_EXPORT WKNavigation *WKPageLoadFileReturningNavigation(WKPageRef page, WKURLRef fileURL, WKURLRef resourceDirectoryURL);
-#endif
#endif // __OBJC__
return webPageProxy->process().processPool().isURLKnownHSTSHost(WebKit::toImpl(url)->string(), privateBrowsingEnabled);
}
-#if !TARGET_OS_IPHONE && (defined(__clang__) && defined(__APPLE__) && !defined(__i386__))
WKNavigation *WKPageLoadURLRequestReturningNavigation(WKPageRef pageRef, WKURLRequestRef urlRequestRef)
{
auto resourceRequest = WebKit::toImpl(urlRequestRef)->resourceRequest();
{
return WebKit::wrapper(WebKit::toImpl(pageRef)->loadFile(WebKit::toWTFString(fileURL), WebKit::toWTFString(resourceDirectoryURL)));
}
-#endif
#if PLATFORM(MAC)
bool WKPageIsPlayingVideoInEnhancedFullscreen(WKPageRef pageRef)
void WebViewImpl::pressureChangeWithEvent(NSEvent *event)
{
-#if defined(__LP64__)
if (event == m_lastPressureEvent)
return;
m_page->handleMouseEvent(webEvent);
m_lastPressureEvent = event;
-#endif
}
#if ENABLE(FULLSCREEN_API)
#if PLATFORM(IOS_FAMILY)
GamepadProvider::setSharedProvider(GameControllerGamepadProvider::singleton());
-#elif defined(__LP64__)
+#else
if (useGameControllerFramework)
GamepadProvider::setSharedProvider(GameControllerGamepadProvider::singleton());
else
GamepadProvider::setSharedProvider(HIDGamepadProvider::singleton());
-#else
- GamepadProvider::setSharedProvider(HIDGamepadProvider::singleton());
#endif
}
{
refreshExistingServices();
-#ifdef __LP64__
auto refreshCallback = [this](NSArray *, NSError *) {
// We coalese refreshes from the notification callbacks because they can come in small batches.
refreshExistingServices(false);
m_extensionWatcher = [NSExtension beginMatchingExtensionsWithAttributes:extensionAttributes completion:refreshCallback];
auto uiExtensionAttributes = @{ @"NSExtensionPointName" : @"com.apple.ui-services" };
m_uiExtensionWatcher = [NSExtension beginMatchingExtensionsWithAttributes:uiExtensionAttributes completion:refreshCallback];
-#endif // __LP64__
}
static void hasCompatibleServicesForItems(dispatch_group_t group, NSArray *items, WTF::Function<void(bool)>&& completionHandler)
auto cgImage = image->makeCGImage();
auto nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:image->size()]);
-#ifdef __LP64__
auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:[nsImage TIFFRepresentation] typeIdentifier:(__bridge NSString *)kUTTypeTIFF]);
items = @[ itemProvider.get() ];
-#else
- items = @[ ];
-#endif
} else if (!m_context.controlledSelectionData().isEmpty()) {
auto selectionData = adoptNS([[NSData alloc] initWithBytes:static_cast<const void*>(m_context.controlledSelectionData().data()) length:m_context.controlledSelectionData().size()]);
auto selection = adoptNS([[NSAttributedString alloc] initWithRTFD:selectionData.get() documentAttributes:nil]);
*(NPBool*)value = true;
break;
}
-
-#ifndef NP_NO_QUICKDRAW
- case NPNVsupportsQuickDrawBool:
- // We don't support the QuickDraw drawing model.
- *(NPBool*)value = false;
- break;
-#endif
-#ifndef NP_NO_CARBON
- case NPNVsupportsCarbonBool:
- *(NPBool*)value = true;
- break;
-#endif
#elif PLATFORM(X11)
case NPNVxDisplay: {
if (!npp)
, m_isComplexTextInputEnabled(false)
, m_hasHandledAKeyDownEvent(false)
, m_ignoreNextKeyUpEventCounter(0)
-#ifndef NP_NO_CARBON
- , m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired)
- , m_npCGContext()
-#endif
#endif
{
m_npp.ndata = this;
// Computes an affine transform from the given coordinate space to the screen coordinate space.
bool getScreenTransform(NPCoordinateSpace sourceSpace, WebCore::AffineTransform&);
-
-#ifndef NP_NO_CARBON
- WindowRef windowRef() const;
- bool isWindowActive() const { return m_windowHasFocus; }
- void updateFakeWindowBounds();
-
- static NetscapePlugin* netscapePluginFromWindow(WindowRef);
- static unsigned buttonState();
-#endif
-
#endif
#if PLUGIN_ARCHITECTURE(UNIX)
WebCore::IntRect m_windowFrameInScreenCoordinates;
WebCore::IntRect m_viewFrameInWindowCoordinates;
-
-#ifndef NP_NO_CARBON
- void nullEventTimerFired();
-
- // FIXME: It's a bit wasteful to have one null event timer per plug-in.
- // We should investigate having one per window.
- RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
- NP_CGContext m_npCGContext;
-#endif
#elif PLUGIN_ARCHITECTURE(UNIX)
std::unique_ptr<NetscapePluginUnix> m_impl;
#endif
namespace WebKit {
using namespace WebCore;
-#ifndef NP_NO_CARBON
-static const Seconds nullEventIntervalActive { 20_ms };
-
-static unsigned buttonStateFromLastMouseEvent;
-
-#endif
-
NPError NetscapePlugin::setDrawingModel(NPDrawingModel drawingModel)
{
// The drawing model can only be set from NPP_New.
return NPERR_GENERIC_ERROR;
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw:
-#endif
case NPDrawingModelCoreGraphics:
case NPDrawingModelCoreAnimation:
m_drawingModel = drawingModel;
return NPERR_GENERIC_ERROR;
switch (eventModel) {
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
-#endif
case NPEventModelCocoa:
m_eventModel = eventModel;
break;
return controller()->compositingRenderServerPort();
}
-#ifndef NP_NO_CARBON
-typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
-
-static WindowMap& windowMap()
-{
- static NeverDestroyed<WindowMap> windowMap;
- return windowMap;
-}
-#endif
-
static void NSException_release(id, SEL)
{
// Do nothing.
bool NetscapePlugin::platformPostInitialize()
{
- if (m_drawingModel == static_cast<NPDrawingModel>(-1)) {
-#ifndef NP_NO_QUICKDRAW
- // Default to QuickDraw if the plugin did not specify a drawing model.
- m_drawingModel = NPDrawingModelQuickDraw;
-#else
- // QuickDraw is not available, so we can't default to it. Instead, default to CoreGraphics.
+ if (m_drawingModel == static_cast<NPDrawingModel>(-1))
m_drawingModel = NPDrawingModelCoreGraphics;
-#endif
- }
- if (m_eventModel == static_cast<NPEventModel>(-1)) {
- // If the plug-in did not specify a drawing model we default to Carbon when it is available.
-#ifndef NP_NO_CARBON
- m_eventModel = NPEventModelCarbon;
-#else
+ if (m_eventModel == static_cast<NPEventModel>(-1))
m_eventModel = NPEventModelCocoa;
-#endif // NP_NO_CARBON
- }
-
-#if !defined(NP_NO_CARBON) && !defined(NP_NO_QUICKDRAW)
- // The CA drawing model does not work with the Carbon event model.
- if (m_drawingModel == NPDrawingModelCoreAnimation && m_eventModel == NPEventModelCarbon)
- return false;
-
- // The Cocoa event model does not work with the QuickDraw drawing model.
- if (m_eventModel == NPEventModelCocoa && m_drawingModel == NPDrawingModelQuickDraw)
- return false;
-#endif
-
-#ifndef NP_NO_QUICKDRAW
- // Right now we don't support the QuickDraw drawing model at all
- if (m_drawingModel == NPDrawingModelQuickDraw &&
- !m_pluginModule->pluginQuirks().contains(PluginQuirks::AllowHalfBakedQuickDrawSupport))
- return false;
-#endif
updatePluginLayer();
-#ifndef NP_NO_CARBON
- if (m_eventModel == NPEventModelCarbon) {
- // Initialize the fake Carbon window.
- ::Rect bounds = { 0, 0, 0, 0 };
- CreateNewWindow(kDocumentWindowClass, kWindowNoTitleBarAttribute, &bounds, reinterpret_cast<WindowRef*>(&m_npCGContext.window));
- ASSERT(m_npCGContext.window);
-
- // FIXME: Disable the backing store.
-
- m_npWindow.window = &m_npCGContext;
-
- ASSERT(!windowMap().contains(windowRef()));
- windowMap().set(windowRef(), this);
-
- // Start the null event timer.
- // FIXME: Throttle null events when the plug-in isn't visible on screen.
- m_nullEventTimer.startRepeating(nullEventIntervalActive);
- }
-#endif
-
return true;
}
void NetscapePlugin::platformDestroy()
{
-#ifndef NP_NO_CARBON
- if (m_eventModel == NPEventModelCarbon) {
- if (WindowRef window = windowRef()) {
- // Destroy the fake Carbon window.
- DisposeWindow(window);
-
- ASSERT(windowMap().contains(window));
- windowMap().remove(window);
- }
-
- // Stop the null event timer.
- m_nullEventTimer.stop();
- }
-#endif
}
bool NetscapePlugin::platformInvalidate(const IntRect&)
case NPEventModelCocoa:
// Nothing to do
break;
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
- updateFakeWindowBounds();
- break;
-#endif
default:
ASSERT_NOT_REACHED();
}
return event;
}
-#ifndef NP_NO_CARBON
-NetscapePlugin* NetscapePlugin::netscapePluginFromWindow(WindowRef windowRef)
-{
- return windowMap().get(windowRef);
-}
-
-WindowRef NetscapePlugin::windowRef() const
-{
- ASSERT(m_eventModel == NPEventModelCarbon);
-
- return reinterpret_cast<WindowRef>(m_npCGContext.window);
-}
-
-void NetscapePlugin::updateFakeWindowBounds()
-{
- double screenX, screenY;
- bool didConvert = convertPoint(0, 0, NPCoordinateSpacePlugin, screenX, screenY, NPCoordinateSpaceFlippedScreen);
- ASSERT_UNUSED(didConvert, didConvert);
-
- Rect bounds;
- bounds.top = screenY;
- bounds.left = screenX;
- bounds.bottom = screenY + m_pluginSize.height();
- bounds.right = screenX + m_pluginSize.width();
-
- ::SetWindowBounds(windowRef(), kWindowStructureRgn, &bounds);
-}
-
-unsigned NetscapePlugin::buttonState()
-{
- return buttonStateFromLastMouseEvent;
-}
-
-static inline EventRecord initializeEventRecord(EventKind eventKind)
-{
- EventRecord eventRecord;
-
- eventRecord.what = eventKind;
- eventRecord.message = 0;
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- eventRecord.when = TickCount();
- ALLOW_DEPRECATED_DECLARATIONS_END
- eventRecord.where = Point();
- eventRecord.modifiers = 0;
-
- return eventRecord;
-}
-
-static bool anyMouseButtonIsDown(const WebEvent& event)
-{
- if (event.type() == WebEvent::MouseDown)
- return true;
-
- if (event.type() == WebEvent::MouseMove && static_cast<const WebMouseEvent&>(event).button() != WebMouseEvent::NoButton)
- return true;
-
- return false;
-}
-
-static bool rightMouseButtonIsDown(const WebEvent& event)
-{
- if (event.type() == WebEvent::MouseDown && static_cast<const WebMouseEvent&>(event).button() == WebMouseEvent::RightButton)
- return true;
-
- if (event.type() == WebEvent::MouseMove && static_cast<const WebMouseEvent&>(event).button() == WebMouseEvent::RightButton)
- return true;
-
- return false;
-}
-
-static EventModifiers modifiersForEvent(const WebEvent& event)
-{
- EventModifiers modifiers = 0;
-
- // We only want to set the btnState if a mouse button is _not_ down.
- if (!anyMouseButtonIsDown(event))
- modifiers |= btnState;
-
- if (event.metaKey())
- modifiers |= cmdKey;
-
- if (event.shiftKey())
- modifiers |= shiftKey;
-
- if (event.altKey())
- modifiers |= optionKey;
-
- // Set controlKey if the control key is down or the right mouse button is down.
- if (event.controlKey() || rightMouseButtonIsDown(event))
- modifiers |= controlKey;
-
- return modifiers;
-}
-
-#endif
-
void NetscapePlugin::platformPaint(GraphicsContext& context, const IntRect& dirtyRect, bool isSnapshot)
{
CGContextRef platformContext = context.platformContext();
break;
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- if (platformContext != m_npCGContext.context) {
- m_npCGContext.context = platformContext;
- callSetWindow();
- }
-
- EventRecord event = initializeEventRecord(updateEvt);
- event.message = reinterpret_cast<unsigned long>(windowRef());
-
- NPP_HandleEvent(&event);
- break;
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
return true;
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- EventKind eventKind = nullEvent;
-
- switch (mouseEvent.type()) {
- case WebEvent::MouseDown:
- eventKind = mouseDown;
- buttonStateFromLastMouseEvent |= (1 << buttonNumber(mouseEvent.button()));
- break;
- case WebEvent::MouseUp:
- eventKind = mouseUp;
- buttonStateFromLastMouseEvent &= ~(1 << buttonNumber(mouseEvent.button()));
- break;
- case WebEvent::MouseMove:
- eventKind = nullEvent;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- EventRecord event = initializeEventRecord(eventKind);
- event.modifiers = modifiersForEvent(mouseEvent);
-
- double globalX;
- double globalY;
- if (!convertPoint(eventPositionInPluginCoordinates.x(), eventPositionInPluginCoordinates.y(), NPCoordinateSpacePlugin, globalX, globalY, NPCoordinateSpaceFlippedScreen))
- ASSERT_NOT_REACHED();
-
- event.where.h = globalX;
- event.where.v = globalY;
-
- NPP_HandleEvent(&event);
-
- // Some plug-ins return false even if the mouse event has been handled.
- // This leads to bugs such as <rdar://problem/9167611>. Work around this
- // by always returning true.
- return true;
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
return NPP_HandleEvent(&event);
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
- // Carbon doesn't have wheel events.
- break;
-#endif
-
default:
ASSERT_NOT_REACHED();
}
return NPP_HandleEvent(&event);
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- EventRecord eventRecord = initializeEventRecord(NPEventType_AdjustCursorEvent);
- eventRecord.modifiers = modifiersForEvent(mouseEvent);
-
- return NPP_HandleEvent(&eventRecord);
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
return NPP_HandleEvent(&event);
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- EventRecord eventRecord = initializeEventRecord(NPEventType_AdjustCursorEvent);
- eventRecord.modifiers = modifiersForEvent(mouseEvent);
-
- return NPP_HandleEvent(&eventRecord);
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
break;
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- EventKind eventKind = nullEvent;
-
- switch (keyboardEvent.type()) {
- case WebEvent::KeyDown:
- eventKind = keyboardEvent.isAutoRepeat() ? autoKey : keyDown;
- break;
- case WebEvent::KeyUp:
- eventKind = keyUp;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- EventRecord event = initializeEventRecord(eventKind);
- event.modifiers = modifiersForEvent(keyboardEvent);
- event.message = keyboardEvent.nativeVirtualKeyCode() << 8 | keyboardEvent.macCharCode();
- handled = NPP_HandleEvent(&event);
- break;
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
break;
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- EventRecord event = initializeEventRecord(hasFocus ? NPEventType_GetFocusEvent : NPEventType_LoseFocusEvent);
-
- NPP_HandleEvent(&event);
- break;
- }
-#endif
-
default:
ASSERT_NOT_REACHED();
}
NPP_HandleEvent(&event);
break;
}
-
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- HiliteWindow(windowRef(), hasFocus);
- if (hasFocus)
- SetUserFocusWindow(windowRef());
-
- EventRecord event = initializeEventRecord(activateEvt);
- event.message = reinterpret_cast<unsigned long>(windowRef());
- if (hasFocus)
- event.modifiers |= activeFlag;
-
- NPP_HandleEvent(&event);
- break;
- }
-#endif
default:
ASSERT_NOT_REACHED();
// Nothing to do.
break;
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
- updateFakeWindowBounds();
- break;
-#endif
-
default:
ASSERT_NOT_REACHED();
}
return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this));
}
-
-#ifndef NP_NO_CARBON
-static bool convertStringToKeyCodes(StringView string, ScriptCode scriptCode, Vector<UInt8>& keyCodes)
-{
- // Create the mapping.
- UnicodeMapping mapping;
-
- if (GetTextEncodingFromScriptInfo(scriptCode, kTextLanguageDontCare, kTextRegionDontCare, &mapping.otherEncoding) != noErr)
- return false;
-
- mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, kTextEncodingDefaultVariant, kTextEncodingDefaultFormat);
- mapping.mappingVersion = kUnicodeUseLatestMapping;
-
- // Create the converter
- UnicodeToTextInfo textInfo;
-
- if (CreateUnicodeToTextInfo(&mapping, &textInfo) != noErr)
- return false;
-
- ByteCount inputLength = string.length() * sizeof(UniChar);
- ByteCount inputRead;
- ByteCount outputLength;
- ByteCount maxOutputLength = string.length() * sizeof(UniChar);
-
- Vector<UInt8> outputData(maxOutputLength);
- OSStatus status = ConvertFromUnicodeToText(textInfo, inputLength, string.upconvertedCharacters(), kNilOptions, 0, 0, 0, 0, maxOutputLength, &inputRead, &outputLength, outputData.data());
-
- DisposeUnicodeToTextInfo(&textInfo);
-
- if (status != noErr)
- return false;
-
- keyCodes = WTFMove(outputData);
- return true;
-}
-#endif
-
-#ifndef NP_NO_CARBON
-static ScriptCode scriptCodeFromCurrentKeyboardInputSource()
-{
- ScriptCode scriptCode = smRoman;
- auto inputSource = adoptCF(TISCopyCurrentKeyboardInputSource());
-
- CFTypeRef scriptCodeNumber = TSMGetInputSourceProperty((TSMInputSourceRef)inputSource.get(), kTSMInputSourcePropertyScriptCode);
- ASSERT(CFGetTypeID(scriptCodeNumber) == CFNumberGetTypeID());
- if (scriptCodeNumber)
- CFNumberGetValue((CFNumberRef)scriptCodeNumber, kCFNumberSInt16Type, &scriptCode);
-
- return scriptCode;
-}
-#endif
-
void NetscapePlugin::sendComplexTextInput(const String& textInput)
{
if (!m_pluginWantsLegacyCocoaTextInput) {
NPP_HandleEvent(&event);
break;
}
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon: {
- ScriptCode scriptCode = scriptCodeFromCurrentKeyboardInputSource();
- Vector<UInt8> keyCodes;
-
- if (!convertStringToKeyCodes(textInput, scriptCode, keyCodes))
- return;
-
- // Set the script code as the keyboard script. Normally Carbon does this whenever the input source changes.
- // However, this is only done for the process that has the keyboard focus. We cheat and do it here instead.
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- SetScriptManagerVariable(smKeyScript, scriptCode);
- ALLOW_DEPRECATED_DECLARATIONS_END
-
- EventRecord event = initializeEventRecord(keyDown);
- event.modifiers = 0;
-
- for (auto& keyCode : keyCodes) {
- event.message = keyCode;
- NPP_HandleEvent(&event);
- }
- break;
- }
-#endif
default:
ASSERT_NOT_REACHED();
}
makeCGLPresentLayerOpaque(m_pluginLayer.get());
}
-#ifndef NP_NO_CARBON
-void NetscapePlugin::nullEventTimerFired()
-{
- EventRecord event = initializeEventRecord(nullEvent);
-
- event.message = 0;
- CGPoint mousePosition;
- HIGetMousePosition(kHICoordSpaceScreenPixel, 0, &mousePosition);
- event.where.h = mousePosition.x;
- event.where.v = mousePosition.y;
-
- event.modifiers = GetCurrentKeyModifiers();
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- if (!Button())
- event.modifiers |= btnState;
- ALLOW_DEPRECATED_DECLARATIONS_END
-
- NPP_HandleEvent(&event);
-}
-#endif
-
} // namespace WebKit
#endif // ENABLE(NETSCAPE_PLUGIN_API)
+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * Plugins/WebNetscapePluginEventHandler.mm:
+ (WebNetscapePluginEventHandler::create):
+ * Plugins/WebNetscapePluginView.h:
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]):
+ (-[WebNetscapePluginView restorePortState:]):
+ (-[WebNetscapePluginView sendEvent:isDrawRect:]):
+ (-[WebNetscapePluginView isNewWindowEqualToOldWindow]):
+ (-[WebNetscapePluginView updateAndSetWindow]):
+ (-[WebNetscapePluginView setWindowIfNecessary]):
+ (-[WebNetscapePluginView createPlugin]):
+ (-[WebNetscapePluginView fini]):
+ (-[WebNetscapePluginView drawRect:]):
+ (-[WebNetscapePluginView invalidateRegion:]):
+ (-[WebNetscapePluginView getVariable:value:]):
+ (-[WebNetscapePluginView setVariable:value:]):
+ (isDrawingModelQuickDraw): Deleted.
+ (-[WebNetscapePluginView fixWindowPort]): Deleted.
+ (getQDPixelFormatForBitmapContext): Deleted.
+ (-[WebNetscapePluginView tellQuickTimeToChill]): Deleted.
+ (-[WebNetscapePluginView _printedPluginBitmap]): Deleted.
+ * WebView/WebDelegateImplementationCaching.mm:
+
2019-03-02 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Programmatic paste access should be granted when copying and pasting within the same origin
std::unique_ptr<WebNetscapePluginEventHandler> WebNetscapePluginEventHandler::create(WebNetscapePluginView *pluginView)
{
switch ([pluginView eventModel]) {
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
- return std::make_unique<WebNetscapePluginEventHandlerCarbon>(pluginView);
-#endif
- case NPEventModelCocoa:
- return std::make_unique<WebNetscapePluginEventHandlerCocoa>(pluginView);
- default:
- ASSERT_NOT_REACHED();
- return nullptr;
+ case NPEventModelCocoa:
+ return std::make_unique<WebNetscapePluginEventHandlerCocoa>(pluginView);
+ default:
+ ASSERT_NOT_REACHED();
+ return nullptr;
}
}
class WebNetscapePluginEventHandler;
typedef union PluginPort {
-#ifndef NP_NO_QUICKDRAW
- NP_Port qdPort;
-#endif
NP_CGContext cgPort;
} PluginPort;
PluginPort lastSetPort;
NPDrawingModel drawingModel;
NPEventModel eventModel;
-
-#ifndef NP_NO_QUICKDRAW
- // This is only valid when drawingModel is NPDrawingModelQuickDraw
- GWorldPtr offscreenGWorld;
-#endif
std::unique_ptr<WebNetscapePluginEventHandler> _eventHandler;
#import <WebKitLegacy/WebUIDelegate.h>
#import <objc/runtime.h>
#import <pal/spi/cg/CoreGraphicsSPI.h>
-#import <pal/spi/mac/QuickDrawSPI.h>
#import <wtf/Assertions.h>
#import <wtf/MainThread.h>
#import <wtf/RunLoop.h>
using namespace WebCore;
using namespace WebKit;
-static inline bool isDrawingModelQuickDraw(NPDrawingModel drawingModel)
-{
-#ifndef NP_NO_QUICKDRAW
- return drawingModel == NPDrawingModelQuickDraw;
-#else
- return false;
-#endif
-};
-
@interface WebNetscapePluginView (Internal)
- (NPError)_createPlugin;
- (void)_destroyPlugin;
-- (NSBitmapImageRep *)_printedPluginBitmap;
- (void)_redeliverStream;
- (BOOL)_shouldCancelSrcStream;
@end
TimerFunc m_timerFunc;
};
-#ifndef NP_NO_QUICKDRAW
-
-// QuickDraw is not available in 64-bit
-
-typedef struct {
- GrafPtr oldPort;
- GDHandle oldDevice;
- Point oldOrigin;
- RgnHandle oldClipRegion;
- RgnHandle oldVisibleRegion;
- RgnHandle clipRegion;
- BOOL forUpdate;
-} PortState_QD;
-
-#endif /* NP_NO_QUICKDRAW */
-
typedef struct {
CGContextRef context;
} PortState_CG;
// MARK: EVENTS
-// The WindowRef created by -[NSWindow windowRef] has a QuickDraw GrafPort that covers
-// the entire window frame (or structure region to use the Carbon term) rather then just the window content.
-// We can remove this when <rdar://problem/4201099> is fixed.
-- (void)fixWindowPort
-{
-#ifndef NP_NO_QUICKDRAW
- ASSERT(isDrawingModelQuickDraw(drawingModel));
-
- NSWindow *currentWindow = [self currentWindow];
- if ([currentWindow isKindOfClass:objc_getClass("NSCarbonWindow")])
- return;
-
- float windowHeight = [currentWindow frame].size.height;
- NSView *contentView = [currentWindow contentView];
- NSRect contentRect = [contentView convertRect:[contentView frame] toView:nil]; // convert to window-relative coordinates
-
- CGrafPtr oldPort;
- GetPort(&oldPort);
- SetPort(GetWindowPort((WindowRef)[currentWindow windowRef]));
-
- MovePortTo(static_cast<short>(contentRect.origin.x), /* Flip Y */ static_cast<short>(windowHeight - NSMaxY(contentRect)));
- PortSize(static_cast<short>(contentRect.size.width), static_cast<short>(contentRect.size.height));
-
- SetPort(oldPort);
-#endif
-}
-
-#ifndef NP_NO_QUICKDRAW
-static UInt32 getQDPixelFormatForBitmapContext(CGContextRef context)
-{
- UInt32 byteOrder = CGBitmapContextGetBitmapInfo(context) & kCGBitmapByteOrderMask;
- if (byteOrder == kCGBitmapByteOrderDefault)
- switch (CGBitmapContextGetBitsPerPixel(context)) {
- case 16:
- byteOrder = kCGBitmapByteOrder16Host;
- break;
- case 32:
- byteOrder = kCGBitmapByteOrder32Host;
- break;
- }
- switch (byteOrder) {
- case kCGBitmapByteOrder16Little:
- return k16LE555PixelFormat;
- case kCGBitmapByteOrder32Little:
- return k32BGRAPixelFormat;
- case kCGBitmapByteOrder16Big:
- return k16BE555PixelFormat;
- case kCGBitmapByteOrder32Big:
- return k32ARGBPixelFormat;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-static inline void getNPRect(const CGRect& cgr, NPRect& npr)
-{
- npr.top = static_cast<uint16_t>(cgr.origin.y);
- npr.left = static_cast<uint16_t>(cgr.origin.x);
- npr.bottom = static_cast<uint16_t>(CGRectGetMaxY(cgr));
- npr.right = static_cast<uint16_t>(CGRectGetMaxX(cgr));
-}
-
-#endif
-
static inline void getNPRect(const NSRect& nr, NPRect& npr)
{
npr.top = static_cast<uint16_t>(nr.origin.y);
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
-#ifndef NP_NO_QUICKDRAW
- WindowRef windowRef = (WindowRef)[[self currentWindow] windowRef];
- ASSERT(windowRef);
-
- // Look at the Carbon port to convert top-left-based window coordinates into top-left-based content coordinates.
- if (isDrawingModelQuickDraw(drawingModel)) {
- // If drawing with QuickDraw, fix the window port so that it has the same bounds as the NSWindow's
- // content view. This makes it easier to convert between AppKit view and QuickDraw port coordinates.
- [self fixWindowPort];
-
- ::Rect portBounds;
- CGrafPtr port = GetWindowPort(windowRef);
- GetPortBounds(port, &portBounds);
-
- PixMap *pix = *GetPortPixMap(port);
- boundsInWindow.origin.x += pix->bounds.left - portBounds.left;
- boundsInWindow.origin.y += pix->bounds.top - portBounds.top;
- visibleRectInWindow.origin.x += pix->bounds.left - portBounds.left;
- visibleRectInWindow.origin.y += pix->bounds.top - portBounds.top;
- }
-#endif
-
window.type = NPWindowTypeWindow;
window.x = (int32_t)boundsInWindow.origin.x;
window.y = (int32_t)boundsInWindow.origin.y;
// Save the port state, set up the port for entry into the plugin
PortState portState;
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw: {
- // Set up NS_Port.
- ::Rect portBounds;
- CGrafPtr port = GetWindowPort(windowRef);
- GetPortBounds(port, &portBounds);
- nPort.qdPort.port = port;
- nPort.qdPort.portx = (int32_t)-boundsInWindow.origin.x;
- nPort.qdPort.porty = (int32_t)-boundsInWindow.origin.y;
- window.window = &nPort;
-
- PortState_QD *qdPortState = (PortState_QD*)malloc(sizeof(PortState_QD));
- portState = (PortState)qdPortState;
-
- GetGWorld(&qdPortState->oldPort, &qdPortState->oldDevice);
-
- qdPortState->oldOrigin.h = portBounds.left;
- qdPortState->oldOrigin.v = portBounds.top;
-
- qdPortState->oldClipRegion = NewRgn();
- GetPortClipRegion(port, qdPortState->oldClipRegion);
-
- qdPortState->oldVisibleRegion = NewRgn();
- GetPortVisibleRegion(port, qdPortState->oldVisibleRegion);
-
- RgnHandle clipRegion = NewRgn();
- qdPortState->clipRegion = clipRegion;
-
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- ALLOW_DEPRECATED_DECLARATIONS_END
- if (currentContext && CGContextGetType(currentContext) == kCGContextTypeBitmap) {
- // We check for kCGContextTypeBitmap here, because if we just called CGBitmapContextGetData
- // on any context, we'd log to the console every time. But even if currentContext is a
- // kCGContextTypeBitmap, it still might not be a context we need to create a GWorld for; for example
- // transparency layers will return true, but return 0 for CGBitmapContextGetData.
- void* offscreenData = CGBitmapContextGetData(currentContext);
- if (offscreenData) {
- // If the current context is an offscreen bitmap, then create a GWorld for it.
- ::Rect offscreenBounds;
- offscreenBounds.top = 0;
- offscreenBounds.left = 0;
- offscreenBounds.right = CGBitmapContextGetWidth(currentContext);
- offscreenBounds.bottom = CGBitmapContextGetHeight(currentContext);
- GWorldPtr newOffscreenGWorld;
- QDErr err = NewGWorldFromPtr(&newOffscreenGWorld,
- getQDPixelFormatForBitmapContext(currentContext), &offscreenBounds, 0, 0, 0,
- static_cast<char*>(offscreenData), CGBitmapContextGetBytesPerRow(currentContext));
- ASSERT(newOffscreenGWorld);
- ASSERT(!err);
- if (!err) {
- if (offscreenGWorld)
- DisposeGWorld(offscreenGWorld);
- offscreenGWorld = newOffscreenGWorld;
-
- SetGWorld(offscreenGWorld, NULL);
-
- port = offscreenGWorld;
-
- nPort.qdPort.port = port;
- boundsInWindow = [self bounds];
-
- // Generate a QD origin based on the current affine transform for currentContext.
- CGAffineTransform offscreenMatrix = CGContextGetCTM(currentContext);
- CGPoint origin = {0,0};
- CGPoint axisFlip = {1,1};
- origin = CGPointApplyAffineTransform(origin, offscreenMatrix);
- axisFlip = CGPointApplyAffineTransform(axisFlip, offscreenMatrix);
-
- // Quartz bitmaps have origins at the bottom left, but the axes may be inverted, so handle that.
- origin.x = offscreenBounds.left - origin.x * (axisFlip.x - origin.x);
- origin.y = offscreenBounds.bottom + origin.y * (axisFlip.y - origin.y);
-
- nPort.qdPort.portx = static_cast<int32_t>(-boundsInWindow.origin.x + origin.x);
- nPort.qdPort.porty = static_cast<int32_t>(-boundsInWindow.origin.y - origin.y);
- window.x = 0;
- window.y = 0;
- window.window = &nPort;
-
- // Use the clip bounds from the context instead of the bounds we created
- // from the window above.
- getNPRect(CGRectOffset(CGContextGetClipBoundingBox(currentContext), -origin.x, origin.y), window.clipRect);
- }
- }
- }
-
- MacSetRectRgn(clipRegion,
- window.clipRect.left + nPort.qdPort.portx, window.clipRect.top + nPort.qdPort.porty,
- window.clipRect.right + nPort.qdPort.portx, window.clipRect.bottom + nPort.qdPort.porty);
-
- // Clip to the dirty region if drawing to a window. When drawing to another bitmap context, do not clip.
- if ([NSGraphicsContext currentContext] == [[self currentWindow] graphicsContext]) {
- // Clip to dirty region so plug-in does not draw over already-drawn regions of the window that are
- // not going to be redrawn this update. This forces plug-ins to play nice with z-index ordering.
- if (forUpdate) {
- RgnHandle viewClipRegion = NewRgn();
-
- // Get list of dirty rects from the opaque ancestor -- WebKit does some tricks with invalidation and
- // display to enable z-ordering for NSViews; a side-effect of this is that only the WebHTMLView
- // knows about the true set of dirty rects.
- NSView *opaqueAncestor = [self opaqueAncestor];
- const NSRect *dirtyRects;
- NSInteger dirtyRectCount, dirtyRectIndex;
- [opaqueAncestor getRectsBeingDrawn:&dirtyRects count:&dirtyRectCount];
-
- for (dirtyRectIndex = 0; dirtyRectIndex < dirtyRectCount; dirtyRectIndex++) {
- NSRect dirtyRect = [self convertRect:dirtyRects[dirtyRectIndex] fromView:opaqueAncestor];
- if (!NSEqualSizes(dirtyRect.size, NSZeroSize)) {
- // Create a region for this dirty rect
- RgnHandle dirtyRectRegion = NewRgn();
- SetRectRgn(dirtyRectRegion, static_cast<short>(NSMinX(dirtyRect)), static_cast<short>(NSMinY(dirtyRect)), static_cast<short>(NSMaxX(dirtyRect)), static_cast<short>(NSMaxY(dirtyRect)));
-
- // Union this dirty rect with the rest of the dirty rects
- UnionRgn(viewClipRegion, dirtyRectRegion, viewClipRegion);
- DisposeRgn(dirtyRectRegion);
- }
- }
-
- // Intersect the dirty region with the clip region, so that we only draw over dirty parts
- SectRgn(clipRegion, viewClipRegion, clipRegion);
- DisposeRgn(viewClipRegion);
- }
- }
-
- // Switch to the port and set it up.
- SetPort(port);
- PenNormal();
- ForeColor(blackColor);
- BackColor(whiteColor);
- SetOrigin(nPort.qdPort.portx, nPort.qdPort.porty);
- SetPortClipRegion(nPort.qdPort.port, clipRegion);
-
- if (forUpdate) {
- // AppKit may have tried to help us by doing a BeginUpdate.
- // But the invalid region at that level didn't include AppKit's notion of what was not valid.
- // We reset the port's visible region to counteract what BeginUpdate did.
- SetPortVisibleRegion(nPort.qdPort.port, clipRegion);
- InvalWindowRgn(windowRef, clipRegion);
- }
-
- qdPortState->forUpdate = forUpdate;
- break;
- }
-#endif /* NP_NO_QUICKDRAW */
-
case NPDrawingModelCoreGraphics: {
if (![self canDraw]) {
portState = NULL;
PortState_CG *cgPortState = (PortState_CG *)malloc(sizeof(PortState_CG));
portState = (PortState)cgPortState;
cgPortState->context = context;
-
-#ifndef NP_NO_CARBON
- if (eventModel != NPEventModelCocoa) {
- // Update the plugin's window/context
- nPort.cgPort.window = windowRef;
- nPort.cgPort.context = context;
- window.window = &nPort.cgPort;
- }
-#endif /* NP_NO_CARBON */
// Save current graphics context's state; will be restored by -restorePortState:
CGContextSaveGState(context);
ASSERT(portState);
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw: {
- PortState_QD *qdPortState = (PortState_QD *)portState;
- WindowRef windowRef = (WindowRef)[[self currentWindow] windowRef];
- CGrafPtr port = GetWindowPort(windowRef);
-
- SetPort(port);
-
- if (qdPortState->forUpdate)
- ValidWindowRgn(windowRef, qdPortState->clipRegion);
-
- SetOrigin(qdPortState->oldOrigin.h, qdPortState->oldOrigin.v);
-
- SetPortClipRegion(port, qdPortState->oldClipRegion);
- if (qdPortState->forUpdate)
- SetPortVisibleRegion(port, qdPortState->oldVisibleRegion);
-
- DisposeRgn(qdPortState->oldClipRegion);
- DisposeRgn(qdPortState->oldVisibleRegion);
- DisposeRgn(qdPortState->clipRegion);
-
- SetGWorld(qdPortState->oldPort, qdPortState->oldDevice);
- break;
- }
-#endif /* NP_NO_QUICKDRAW */
-
case NPDrawingModelCoreGraphics: {
ASSERT([NSView focusView] == self);
PortState portState = NULL;
- if (isDrawingModelQuickDraw(drawingModel) || (drawingModel != NPDrawingModelCoreAnimation && eventIsDrawRect)) {
+ if (drawingModel != NPDrawingModelCoreAnimation && eventIsDrawRect) {
// In CoreGraphics mode, the port state only needs to be saved/set when redrawing the plug-in view.
// The plug-in is not allowed to draw at any other time.
portState = [self saveAndSetNewPortStateForUpdate:eventIsDrawRect];
// We may have changed the window, so inform the plug-in.
[self setWindowIfNecessary];
}
-
-#if !defined(NDEBUG) && !defined(NP_NO_QUICKDRAW)
- // Draw green to help debug.
- // If we see any green we know something's wrong.
- // Note that PaintRect() only works for QuickDraw plugins; otherwise the current QD port is undefined.
- if (isDrawingModelQuickDraw(drawingModel) && eventIsDrawRect) {
- ForeColor(greenColor);
- const ::Rect bigRect = { -10000, -10000, 10000, 10000 };
- PaintRect(&bigRect);
- ForeColor(blackColor);
- }
-#endif
-
+
// Temporarily retain self in case the plug-in view is released while sending an event.
[[self retain] autorelease];
return NO;
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw:
- if (nPort.qdPort.portx != lastSetPort.qdPort.portx)
- return NO;
- if (nPort.qdPort.porty != lastSetPort.qdPort.porty)
- return NO;
- if (nPort.qdPort.port != lastSetPort.qdPort.port)
- return NO;
- break;
-#endif /* NP_NO_QUICKDRAW */
-
case NPDrawingModelCoreGraphics:
if (nPort.cgPort.window != lastSetPort.cgPort.window)
return NO;
return YES;
}
--(void)tellQuickTimeToChill
-{
-#ifndef NP_NO_QUICKDRAW
- ASSERT(isDrawingModelQuickDraw(drawingModel));
-
- // Make a call to the secret QuickDraw API that makes QuickTime calm down.
- WindowRef windowRef = (WindowRef)[[self window] windowRef];
- if (!windowRef) {
- return;
- }
- CGrafPtr port = GetWindowPort(windowRef);
- ::Rect bounds;
- GetPortBounds(port, &bounds);
- CallDrawingNotifications(port, &bounds, kBitsProc);
-#endif /* NP_NO_QUICKDRAW */
-}
-
- (void)updateAndSetWindow
{
// A plug-in can only update if it's (1) already been started (2) isn't stopped
if (!_isStarted)
return;
-#ifdef NP_NO_QUICKDRAW
if (![self canDraw])
return;
-#else
- if (drawingModel == NPDrawingModelQuickDraw)
- [self tellQuickTimeToChill];
- else if (drawingModel == NPDrawingModelCoreGraphics && ![self canDraw] && _isFlash) {
- // The Flash plug-in does not expect an NPP_SetWindow call from WebKit in this case.
- // See Exception 2 above.
- return;
- }
-#endif // NP_NO_QUICKDRAW
-
+
BOOL didLockFocus = [NSView focusView] != self && [self lockFocusIfCanDraw];
PortState portState = [self saveAndSetNewPortState];
#ifndef NDEBUG
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw:
- LOG(Plugins, "NPP_SetWindow (QuickDraw): %d, port=0x%08x, window.x:%d window.y:%d window.width:%d window.height:%d",
- npErr, (int)nPort.qdPort.port, (int)window.x, (int)window.y, (int)window.width, (int)window.height);
- break;
-#endif /* NP_NO_QUICKDRAW */
-
case NPDrawingModelCoreGraphics:
LOG(Plugins, "NPP_SetWindow (CoreGraphics): %d, window=%p, context=%p, window.x:%d window.y:%d window.width:%d window.height:%d window.clipRect size:%dx%d",
npErr, nPort.cgPort.window, nPort.cgPort.context, (int)window.x, (int)window.y, (int)window.width, (int)window.height,
return NO;
}
- if (drawingModel == (NPDrawingModel)-1) {
-#ifndef NP_NO_QUICKDRAW
- // Default to QuickDraw if the plugin did not specify a drawing model.
- drawingModel = NPDrawingModelQuickDraw;
-#else
- // QuickDraw is not available, so we can't default to it. Instead, default to CoreGraphics.
+ if (drawingModel == (NPDrawingModel)-1)
drawingModel = NPDrawingModelCoreGraphics;
-#endif
- }
- if (eventModel == (NPEventModel)-1) {
- // If the plug-in did not specify a drawing model we default to Carbon when it is available.
-#ifndef NP_NO_CARBON
- eventModel = NPEventModelCarbon;
-#else
+ if (eventModel == (NPEventModel)-1)
eventModel = NPEventModelCocoa;
-#endif // NP_NO_CARBON
- }
-#ifndef NP_NO_CARBON
- if (eventModel == NPEventModelCocoa && isDrawingModelQuickDraw(drawingModel)) {
- LOG(Plugins, "Plugin can't use use Cocoa event model with QuickDraw drawing model: %@", _pluginPackage.get());
- [self _destroyPlugin];
- [_pluginPackage.get() close];
-
- return NO;
- }
-#endif // NP_NO_CARBON
-
if (drawingModel == NPDrawingModelCoreAnimation) {
void *value = 0;
if ([_pluginPackage.get() pluginFuncs]->getvalue(plugin, NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) {
- (void)fini
{
-#ifndef NP_NO_QUICKDRAW
- if (offscreenGWorld)
- DisposeGWorld(offscreenGWorld);
-#endif
-
for (unsigned i = 0; i < argsCount; i++) {
free(cAttributes[i]);
free(cValues[i]);
if ([NSGraphicsContext currentContextDrawingToScreen] || _isFlash)
[self sendDrawRectEvent:rect];
- else {
- NSBitmapImageRep *printedPluginBitmap = [self _printedPluginBitmap];
- if (printedPluginBitmap) {
- // Flip the bitmap before drawing because the QuickDraw port is flipped relative
- // to this view.
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- ALLOW_DEPRECATED_DECLARATIONS_END
- CGContextSaveGState(cgContext);
- NSRect bounds = [self bounds];
- CGContextTranslateCTM(cgContext, 0.0f, NSHeight(bounds));
- CGContextScaleCTM(cgContext, 1.0f, -1.0f);
- [printedPluginBitmap drawInRect:bounds];
- CGContextRestoreGState(cgContext);
- }
- }
}
- (NPObject *)createPluginScriptableObject
LOG(Plugins, "NPN_InvalidateRegion");
NSRect invalidRect = NSZeroRect;
switch (drawingModel) {
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw:
- {
- ::Rect qdRect;
- GetRegionBounds((NPQDRegion)invalidRegion, &qdRect);
- invalidRect = NSMakeRect(qdRect.left, qdRect.top, qdRect.right - qdRect.left, qdRect.bottom - qdRect.top);
- }
- break;
-#endif /* NP_NO_QUICKDRAW */
-
case NPDrawingModelCoreGraphics:
{
CGRect cgRect = CGPathGetBoundingBox((NPCGRegion)invalidRegion);
return NPERR_NO_ERROR;
}
-#ifndef NP_NO_QUICKDRAW
- case NPNVsupportsQuickDrawBool:
- {
- *(NPBool *)value = TRUE;
- return NPERR_NO_ERROR;
- }
-#endif /* NP_NO_QUICKDRAW */
-
case NPNVsupportsCoreGraphicsBool:
{
*(NPBool *)value = TRUE;
*(NPBool *)value = TRUE;
return NPERR_NO_ERROR;
}
-
-#ifndef NP_NO_CARBON
- case NPNVsupportsCarbonBool:
- {
- *(NPBool *)value = TRUE;
- return NPERR_NO_ERROR;
- }
-#endif /* NP_NO_CARBON */
case NPNVsupportsCocoaBool:
{
NPDrawingModel newDrawingModel = (NPDrawingModel)(uintptr_t)value;
switch (newDrawingModel) {
// Supported drawing models:
-#ifndef NP_NO_QUICKDRAW
- case NPDrawingModelQuickDraw:
-#endif
case NPDrawingModelCoreGraphics:
case NPDrawingModelCoreAnimation:
drawingModel = newDrawingModel;
NPEventModel newEventModel = (NPEventModel)(uintptr_t)value;
switch (newEventModel) {
// Supported event models:
-#ifndef NP_NO_CARBON
- case NPEventModelCarbon:
-#endif
case NPEventModelCocoa:
eventModel = newEventModel;
return NPERR_NO_ERROR;
plugin = NULL;
}
-- (NSBitmapImageRep *)_printedPluginBitmap
-{
-#ifdef NP_NO_QUICKDRAW
- return nil;
-#else
- // Cannot print plugins that do not implement NPP_Print
- if (![_pluginPackage.get() pluginFuncs]->print)
- return nil;
-
- // This NSBitmapImageRep will share its bitmap buffer with a GWorld that the plugin will draw into.
- // The bitmap is created in 32-bits-per-pixel ARGB format, which is the default GWorld pixel format.
- NSBitmapImageRep *bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
- pixelsWide:window.width
- pixelsHigh:window.height
- bitsPerSample:8
- samplesPerPixel:4
- hasAlpha:YES
- isPlanar:NO
- colorSpaceName:NSDeviceRGBColorSpace
- bitmapFormat:NSAlphaFirstBitmapFormat
- bytesPerRow:0
- bitsPerPixel:0] autorelease];
- ASSERT(bitmap);
-
- // Create a GWorld with the same underlying buffer into which the plugin can draw
- ::Rect printGWorldBounds;
- SetRect(&printGWorldBounds, 0, 0, window.width, window.height);
- GWorldPtr printGWorld;
- if (NewGWorldFromPtr(&printGWorld,
- k32ARGBPixelFormat,
- &printGWorldBounds,
- NULL,
- NULL,
- 0,
- (Ptr)[bitmap bitmapData],
- [bitmap bytesPerRow]) != noErr) {
- LOG_ERROR("Could not create GWorld for printing");
- return nil;
- }
-
- /// Create NPWindow for the GWorld
- NPWindow printNPWindow;
- printNPWindow.window = &printGWorld; // Normally this is an NP_Port, but when printing it is the actual CGrafPtr
- printNPWindow.x = 0;
- printNPWindow.y = 0;
- printNPWindow.width = window.width;
- printNPWindow.height = window.height;
- printNPWindow.clipRect.top = 0;
- printNPWindow.clipRect.left = 0;
- printNPWindow.clipRect.right = window.width;
- printNPWindow.clipRect.bottom = window.height;
- printNPWindow.type = NPWindowTypeDrawable; // Offscreen graphics port as opposed to a proper window
-
- // Create embed-mode NPPrint
- NPPrint npPrint;
- npPrint.mode = NP_EMBED;
- npPrint.print.embedPrint.window = printNPWindow;
- npPrint.print.embedPrint.platformPrint = printGWorld;
-
- // Tell the plugin to print into the GWorld
- [self willCallPlugInFunction];
- {
- JSC::JSLock::DropAllLocks dropAllLocks(commonVM());
- [_pluginPackage.get() pluginFuncs]->print(plugin, &npPrint);
- }
- [self didCallPlugInFunction];
-
- // Don't need the GWorld anymore
- DisposeGWorld(printGWorld);
-
- return bitmap;
-#endif
-}
-
- (void)_redeliverStream
{
if ([self dataSource] && _isStarted) {
typedef float (*ObjCMsgSendFPRet)(id, SEL, ...);
#if !PLATFORM(IOS_FAMILY)
-#if defined(__i386__)
-static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend_fpret);
-#else
static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend);
#endif
-#endif
static inline id CallDelegate(WebView *self, id delegate, SEL selector)
{
+2019-03-03 Tim Horton <timothy_horton@apple.com>
+
+ Remove some more unused 32-bit code
+ https://bugs.webkit.org/show_bug.cgi?id=195255
+
+ Reviewed by Darin Adler.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/TestNetscapePlugIn/Tests/mac/SupportsCarbonEventModel.cpp: Removed.
+ * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+ (NPP_New):
+ (NPP_HandleEvent):
+ (handleEventCarbon): Deleted.
+
2019-03-02 Ross Kirsling <ross.kirsling@sony.com>
Unreviewed follow-up to r242292. Keep EXPECT_STREQ in tests per Darin's request.
141BF438096A455900E0753C /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; };
141BF439096A455900E0753C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; };
- 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */; };
1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E4296141141C400388758 /* PrivateBrowsing.cpp */; };
1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */; };
1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; };
141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; };
141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
- 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SupportsCarbonEventModel.cpp; sourceTree = "<group>"; };
1A1E4296141141C400388758 /* PrivateBrowsing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateBrowsing.cpp; sourceTree = "<group>"; };
1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOpenInDestroyStream.cpp; sourceTree = "<group>"; };
1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; };
1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */,
1A31EB3713466AC100017372 /* ConvertPoint.cpp */,
520206CE1A0ADA5900AD5154 /* SetMuted.cpp */,
- 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */,
);
path = mac;
sourceTree = "<group>";
1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */,
520206CF1A0ADA5900AD5154 /* SetMuted.cpp in Sources */,
5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */,
- 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */,
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */,
1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */,
00F048541A0C3C9A000244DB /* URLRedirect.cpp in Sources */,
+++ /dev/null
-/*
- * Copyright (C) 2011 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 INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginTest.h"
-
-using namespace std;
-
-// Test that we report that we support the Carbon event model in 32-bit.
-class SupportsCarbonEventModel : public PluginTest {
-public:
- SupportsCarbonEventModel(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- {
- }
-
-private:
- bool runTest()
- {
-#ifdef NP_NO_CARBON
- // There's no support for Carbon, so we can't test anything.
- return true;
-#else
- NPBool supportsCarbonEventModel = false;
- if (NPN_GetValue(NPNVsupportsCarbonBool, &supportsCarbonEventModel) != NPERR_NO_ERROR)
- return false;
-
- return supportsCarbonEventModel;
-#endif
- }
-
- virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
- {
- if (runTest())
- executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'");
-
- return NPERR_NO_ERROR;
- }
-};
-
-static PluginTest::Register<SupportsCarbonEventModel> supportsCarbonEventModel("supports-carbon-event-model");
#include <X11/Xutil.h>
#endif
-#if !defined(NP_NO_CARBON) && defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
-extern "C" void GlobalToLocal(Point*);
-#endif
-
using namespace std;
static bool getEntryPointsWasCalled;
if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCoreAnimation) != NPERR_NO_ERROR)
supportsCoreAnimation = false;
-#ifndef NP_NO_CARBON
- NPBool supportsCarbon = false;
-#endif
NPBool supportsCocoa = false;
-#ifndef NP_NO_CARBON
- // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model.
- if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR)
- supportsCarbon = true;
-#endif
-
if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
supportsCocoa = false;
- if (supportsCocoa) {
+ if (supportsCocoa)
eventModel = NPEventModelCocoa;
-#ifndef NP_NO_CARBON
- } else if (supportsCarbon) {
- eventModel = NPEventModelCarbon;
-#endif
- } else {
+ else
return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
browser->setvalue(instance, NPPVpluginEventModel, (void *)eventModel);
#endif // XP_MACOSX
}
#ifdef XP_MACOSX
-#ifndef NP_NO_CARBON
-static int16_t handleEventCarbon(NPP instance, PluginObject* obj, EventRecord* event)
-{
- Point pt = { event->where.v, event->where.h };
-
- switch (event->what) {
- case nullEvent:
- // these are delivered non-deterministically, don't log.
- break;
- case mouseDown:
- if (obj->eventLogging) {
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- GlobalToLocal(&pt);
- ALLOW_DEPRECATED_DECLARATIONS_END
- pluginLog(instance, "mouseDown at (%d, %d)", pt.h, pt.v);
- }
- if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case mouseUp:
- if (obj->eventLogging) {
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- GlobalToLocal(&pt);
- ALLOW_DEPRECATED_DECLARATIONS_END
- pluginLog(instance, "mouseUp at (%d, %d)", pt.h, pt.v);
- }
- break;
- case keyDown:
- if (obj->eventLogging)
- pluginLog(instance, "keyDown '%c'", (char)(event->message & 0xFF));
- if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case keyUp:
- if (obj->eventLogging)
- pluginLog(instance, "keyUp '%c'", (char)(event->message & 0xFF));
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = false;
- obj->testKeyboardFocusForPlugins = FALSE;
- executeScript(obj, "testRunner.notifyDone();");
- }
- break;
- case autoKey:
- if (obj->eventLogging)
- pluginLog(instance, "autoKey '%c'", (char)(event->message & 0xFF));
- break;
- case updateEvt:
- if (obj->eventLogging)
- pluginLog(instance, "updateEvt");
- break;
- case diskEvt:
- if (obj->eventLogging)
- pluginLog(instance, "diskEvt");
- break;
- case activateEvt:
- if (obj->eventLogging)
- pluginLog(instance, "activateEvt");
- break;
- case osEvt:
- if (!obj->eventLogging)
- break;
- printf("PLUGIN: osEvt - ");
- switch ((event->message & 0xFF000000) >> 24) {
- case suspendResumeMessage:
- printf("%s\n", (event->message & 0x1) ? "resume" : "suspend");
- break;
- case mouseMovedMessage:
- printf("mouseMoved\n");
- break;
- default:
- printf("%08lX\n", event->message);
- }
- break;
- case kHighLevelEvent:
- if (obj->eventLogging)
- pluginLog(instance, "kHighLevelEvent");
- break;
- // NPAPI events
- case NPEventType_GetFocusEvent:
- if (obj->eventLogging)
- pluginLog(instance, "getFocusEvent");
- break;
- case NPEventType_LoseFocusEvent:
- if (obj->eventLogging)
- pluginLog(instance, "loseFocusEvent");
- break;
- case NPEventType_AdjustCursorEvent:
- if (obj->eventLogging)
- pluginLog(instance, "adjustCursorEvent");
- break;
- default:
- if (obj->eventLogging)
- pluginLog(instance, "event %d", event->what);
- }
-
- return 0;
-}
-#endif
-
static int16_t handleEventCocoa(NPP instance, PluginObject* obj, NPCocoaEvent* event)
{
switch (event->type) {
return 1;
#ifdef XP_MACOSX
-#ifndef NP_NO_CARBON
- if (obj->eventModel == NPEventModelCarbon)
- return handleEventCarbon(instance, obj, static_cast<EventRecord*>(event));
-#endif
-
assert(obj->eventModel == NPEventModelCocoa);
return handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(event));
#elif defined(MOZ_X11)