diff options
author | Moonchild <moonchild@palemoon.org> | 2021-05-03 12:26:37 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-05-03 12:26:37 +0000 |
commit | fc7a34ce36d66eb030094a0eb447c9ed61924e0e (patch) | |
tree | 70066c56efbbfe430472baac892e32a3bab4f04f /layout/generic | |
parent | 1fef83db8258c812026d6e995d74fd2b565d7597 (diff) | |
download | aura-central-fc7a34ce36d66eb030094a0eb447c9ed61924e0e.tar.gz |
Issue mcp-graveyard/UXP%1751 -- Remove XP_MACOSX conditionals from /layout
Diffstat (limited to 'layout/generic')
-rw-r--r-- | layout/generic/nsFrame.cpp | 11 | ||||
-rw-r--r-- | layout/generic/nsPluginFrame.cpp | 127 | ||||
-rw-r--r-- | layout/generic/nsSelection.cpp | 18 |
3 files changed, 4 insertions, 152 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 5d05b7103..b8e66ecbc 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:cindent:ts=2:et:sw=2: /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -3056,11 +3055,7 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection* aFrameSelection, { // In Browser, special 'table selection' key must be pressed for table selection // or when just Shift is pressed and we're already in table/cell selection mode -#ifdef XP_MACOSX - doTableSelection = aMouseEvent->IsMeta() || (aMouseEvent->IsShift() && selectingTableCells); -#else doTableSelection = aMouseEvent->IsControl() || (aMouseEvent->IsShift() && selectingTableCells); -#endif } if (!doTableSelection) return NS_OK; @@ -3329,13 +3324,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext, if (!frameselection || frameselection->GetDisplaySelection() == nsISelectionController::SELECTION_OFF) return NS_OK;//nothing to do we cannot affect selection from here -#ifdef XP_MACOSX - if (mouseEvent->IsControl()) - return NS_OK;//short circuit. hard coded for mac due to time restraints. - bool control = mouseEvent->IsMeta(); -#else bool control = mouseEvent->IsControl(); -#endif RefPtr<nsFrameSelection> fc = const_cast<nsFrameSelection*>(frameselection); if (mouseEvent->mClickCount > 1) { diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index eee3f46b8..ea42d9bd3 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -69,11 +69,6 @@ #endif /* MOZ_LOGGING */ #include "mozilla/Logging.h" -#ifdef XP_MACOSX -#include "gfxQuartzNativeDrawing.h" -#include "mozilla/gfx/QuartzSupport.h" -#endif - #ifdef MOZ_X11 #include "mozilla/X11Util.h" using mozilla::DefaultXDisplay; @@ -318,15 +313,6 @@ nsPluginFrame::PrepForDrawing(nsIWidget *aWidget) mInnerView->AttachWidgetEventHandler(mWidget); -#ifdef XP_MACOSX - // On Mac, we need to invalidate ourselves since even windowed - // plugins are painted through Thebes and we need to ensure - // the PaintedLayer containing the plugin is updated. - if (parentWidget == GetNearestWidget()) { - InvalidateFrame(); - } -#endif - RegisterPluginForGeometryUpdates(); // Here we set the background color for this widget because some plugins will use @@ -565,27 +551,12 @@ nsPluginFrame::FixupWindow(const nsSize& aSize) nsIntPoint origin = GetWindowOriginInPixels(windowless); // window must be in "display pixels" -#if defined(XP_MACOSX) - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - int intScaleFactor = ceil(scaleFactor); - window->x = origin.x / intScaleFactor; - window->y = origin.y / intScaleFactor; - window->width = presContext->AppUnitsToDevPixels(aSize.width) / intScaleFactor; - window->height = presContext->AppUnitsToDevPixels(aSize.height) / intScaleFactor; -#else window->x = origin.x; window->y = origin.y; window->width = presContext->AppUnitsToDevPixels(aSize.width); window->height = presContext->AppUnitsToDevPixels(aSize.height); -#endif -#ifndef XP_MACOSX mInstanceOwner->UpdateWindowPositionAndClipRect(false); -#endif NotifyPluginReflowObservers(); } @@ -616,13 +587,6 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden) RefPtr<nsPluginInstanceOwner> instanceOwnerRef(mInstanceOwner); // refresh the plugin port as well -#ifdef XP_MACOSX - mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable); - // Bail now if our frame has been destroyed. - if (!instanceOwnerRef->GetFrame()) { - return NS_ERROR_FAILURE; - } -#endif window->window = mInstanceOwner->GetPluginPort(); // Adjust plugin dimensions according to pixel snap results @@ -642,24 +606,11 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden) intBounds.x += intOffset.x; intBounds.y += intOffset.y; -#if defined(XP_MACOSX) - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(instanceOwnerRef->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - - size_t intScaleFactor = ceil(scaleFactor); - window->x = intBounds.x / intScaleFactor; - window->y = intBounds.y / intScaleFactor; - window->width = intBounds.width / intScaleFactor; - window->height = intBounds.height / intScaleFactor; -#else window->x = intBounds.x; window->y = intBounds.y; window->width = intBounds.width; window->height = intBounds.height; -#endif + // BE CAREFUL: By the time we get here the PluginFrame is sometimes destroyed // and poisoned. If we reference local fields (implicit this deref), // we will crash. @@ -1061,11 +1012,6 @@ nsPluginFrame::NotifyPluginReflowObservers() void nsPluginFrame::DidSetWidgetGeometry() { -#if defined(XP_MACOSX) - if (mInstanceOwner && !IsHidden()) { - mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable); - } -#else if (!mWidget && mInstanceOwner) { // UpdateWindowVisibility will notify the plugin of position changes // by updating the NPWindow and calling NPP_SetWindow/AsyncSetWindow. @@ -1076,29 +1022,20 @@ nsPluginFrame::DidSetWidgetGeometry() nsLayoutUtils::IsPopup(nsLayoutUtils::GetDisplayRootFrame(this)) || !mNextConfigurationBounds.IsEmpty()); } -#endif } bool nsPluginFrame::IsOpaque() const { -#if defined(XP_MACOSX) - return false; -#else - if (mInstanceOwner && mInstanceOwner->UseAsyncRendering()) { return false; } return !IsTransparentMode(); -#endif } bool nsPluginFrame::IsTransparentMode() const { -#if defined(XP_MACOSX) - return false; -#else if (!mInstanceOwner) return false; @@ -1120,7 +1057,6 @@ nsPluginFrame::IsTransparentMode() const bool transparent = false; pi->IsTransparent(&transparent); return transparent; -#endif } void @@ -1141,27 +1077,20 @@ nsPluginFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, DO_GLOBAL_REFLOW_COUNT_DSP("nsPluginFrame"); -#ifndef XP_MACOSX if (mWidget && aBuilder->IsInTransform()) { // Windowed plugins should not be rendered inside a transform. return; } -#endif if (aBuilder->IsForPainting() && mInstanceOwner) { // Update plugin frame for both content scaling and full zoom changes. mInstanceOwner->ResolutionMayHaveChanged(); -#ifdef XP_MACOSX - mInstanceOwner->WindowFocusMayHaveChanged(); -#endif if (mInstanceOwner->UseAsyncRendering()) { NPWindow* window = nullptr; mInstanceOwner->GetWindow(window); bool isVisible = window && window->width > 0 && window->height > 0; if (isVisible && aBuilder->ShouldSyncDecodeImages()) { -#ifndef XP_MACOSX mInstanceOwner->UpdateWindowVisibility(true); -#endif } mInstanceOwner->NotifyPaintWaiter(aBuilder); @@ -1238,8 +1167,8 @@ nsPluginFrame::PrintPlugin(nsRenderingContext& aRenderingContext, window.clipRect.left = 0; window.clipRect.right = 0; // platform specific printing code -#if defined(XP_UNIX) || defined(XP_MACOSX) - // Doesn't work in a thebes world, or on OS X. +#if defined(XP_UNIX) + // Doesn't work in a thebes world. (void)window; (void)npprint; #elif defined(XP_WIN) @@ -1377,20 +1306,7 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder, if (window->width <= 0 || window->height <= 0) return nullptr; -#if defined(XP_MACOSX) - // window is in "display pixels", but size needs to be in device pixels - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - - size_t intScaleFactor = ceil(scaleFactor); -#else - size_t intScaleFactor = 1; -#endif - - IntSize size(window->width * intScaleFactor, window->height * intScaleFactor); + IntSize size(window->width, window->height); nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame(); gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel()); @@ -1420,11 +1336,6 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder, NS_ASSERTION(layer->GetType() == Layer::TYPE_IMAGE, "Bad layer type"); ImageLayer* imglayer = static_cast<ImageLayer*>(layer.get()); -#ifdef XP_MACOSX - if (!mInstanceOwner->UseAsyncRendering()) { - mInstanceOwner->DoCocoaEventDrawRect(r, nullptr); - } -#endif imglayer->SetScaleToSize(size, ScaleMode::STRETCH); imglayer->SetContainer(container); @@ -1545,37 +1456,11 @@ nsPluginFrame::HandleEvent(nsPresContext* aPresContext, return rv; #endif -#ifdef XP_MACOSX - // we want to process some native mouse events in the cocoa event model - if ((anEvent->mMessage == eMouseEnterIntoWidget || - anEvent->mMessage == eWheel) && - mInstanceOwner->GetEventModel() == NPEventModelCocoa) { - *anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); - // Due to plugin code reentering Gecko, this frame may be dead at this - // point. - return rv; - } - - // These two calls to nsIPresShell::SetCapturingContext() (on mouse-down - // and mouse-up) are needed to make the routing of mouse events while - // dragging conform to standard OS X practice, and to the Cocoa NPAPI spec. - // See bug 525078 and bug 909678. - if (anEvent->mMessage == eMouseDown) { - nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED); - } -#endif - rv = nsFrame::HandleEvent(aPresContext, anEvent, anEventStatus); // We need to be careful from this point because the call to // nsFrame::HandleEvent() might have killed us. -#ifdef XP_MACOSX - if (anEvent->mMessage == eMouseUp) { - nsIPresShell::SetCapturingContent(nullptr, 0); - } -#endif - return rv; } @@ -1751,11 +1636,7 @@ NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) bool nsPluginFrame::IsPaintedByGecko() const { -#ifdef XP_MACOSX - return true; -#else return !mWidget; -#endif } NS_IMPL_FRAMEARENA_HELPERS(nsPluginFrame) diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index ba7f48403..7aca3696b 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -552,10 +552,6 @@ nsFrameSelection::nsFrameSelection() mSelectedCellIndex = 0; nsAutoCopyListener *autoCopy = nullptr; - // On macOS, cache the current selection to send to osx service menu. -#ifdef XP_MACOSX - autoCopy = nsAutoCopyListener::GetInstance(nsIClipboard::kSelectionCache); -#endif // Check to see if the autocopy pref is enabled // and add the autocopy listener if it is @@ -1978,16 +1974,6 @@ nsFrameSelection::RepaintSelection(SelectionType aSelectionType) return NS_ERROR_NULL_POINTER; NS_ENSURE_STATE(mShell); -// On macOS, update the selection cache to the new active selection -// aka the current selection. -#ifdef XP_MACOSX - nsFocusManager* fm = nsFocusManager::GetFocusManager(); - // Check an active window exists otherwise there cannot be a current selection - // and that it's a normal selection. - if (fm->GetActiveWindow() && aSelectionType == SelectionType::eNormal) { - UpdateSelectionCacheOnRepaintSelection(mDomSelections[index]); - } -#endif return mDomSelections[index]->Repaint(mShell->GetPresContext()); } @@ -2711,11 +2697,7 @@ printf("aTarget == %d\n", aTarget); // Any other mouseup actions require that Ctrl or Cmd key is pressed // else stop table selection mode bool doMouseUpAction = false; -#ifdef XP_MACOSX - doMouseUpAction = aMouseEvent->IsMeta(); -#else doMouseUpAction = aMouseEvent->IsControl(); -#endif if (!doMouseUpAction) { #ifdef DEBUG_TABLE_SELECTION |