Backed out changeset 1f34d528c0f1 (bug 979692)

This commit is contained in:
Ed Morley 2014-05-19 15:36:36 +01:00
parent cac9e66437
commit 3452af7d1e
6 changed files with 1 additions and 58 deletions

View File

@ -1110,17 +1110,6 @@ CanvasRenderingContext2D::GetImageBuffer(uint8_t** aImageBuffer,
*aFormat = imgIEncoder::INPUT_FORMAT_HOSTARGB;
}
nsString CanvasRenderingContext2D::GetHitRegion(const mozilla::gfx::Point& aPoint)
{
for (unsigned int x = 0 ; x < mHitRegionsOptions.Length(); x++) {
RegionInfo& info = mHitRegionsOptions[x];
if (info.mPath->ContainsPoint(aPoint, Matrix())) {
return info.mId;
}
}
return nsString();
}
NS_IMETHODIMP
CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
const char16_t *aEncoderOptions,

View File

@ -537,11 +537,6 @@ public:
virtual void GetImageBuffer(uint8_t** aImageBuffer, int32_t* aFormat);
// Given a point, return hit region ID if it exists
nsString GetHitRegion(const mozilla::gfx::Point& aPoint);
// return true and fills in the bound rect if element has a hit region.
bool GetHitRegionRect(Element* aElement, nsRect& aRect);

View File

@ -185,8 +185,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
virtual nsresult PreHandleEvent(mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
/*
* Helpers called by various users of Canvas
*/

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
@ -14,10 +14,7 @@
#include "mozilla/dom/CanvasRenderingContext2D.h"
#include "mozilla/dom/HTMLCanvasElementBinding.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsAttrValueInlines.h"
@ -31,7 +28,6 @@
#include "nsIWritablePropertyBag2.h"
#include "nsIXPConnect.h"
#include "nsJSUtils.h"
#include "nsLayoutUtils.h"
#include "nsMathUtils.h"
#include "nsNetUtil.h"
#include "nsStreamUtils.h"
@ -292,34 +288,6 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
return rv;
}
nsresult HTMLCanvasElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT) {
WidgetMouseEventBase* evt = (WidgetMouseEventBase*)aVisitor.mEvent;
if (evt) {
nsCOMPtr<nsISupports> cxt;
GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
nsRefPtr<CanvasRenderingContext2D> context2d =
static_cast<CanvasRenderingContext2D*>(cxt.get());
if (context2d) {
nsIFrame *frame = GetPrimaryFrame();
if (!frame)
return NS_OK;
nsPoint ptInRoot = nsLayoutUtils::GetEventCoordinatesRelativeTo(evt, frame);
nsRect paddingRect = frame->GetContentRectRelativeToSelf();
Point hitpoint;
hitpoint.x = (ptInRoot.x - paddingRect.x) / AppUnitsPerCSSPixel();
hitpoint.y = (ptInRoot.y - paddingRect.y) / AppUnitsPerCSSPixel();
evt->region = context2d->GetHitRegion(hitpoint);
aVisitor.mCanHandle = true;
}
}
}
return nsGenericHTMLElement::PreHandleEvent(aVisitor);
}
nsChangeHint
HTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const

View File

@ -299,10 +299,6 @@ void
MouseEvent::GetRegion(nsAString& aRegion)
{
SetDOMStringToNull(aRegion);
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
if (mouseEventBase) {
aRegion = mouseEventBase->region;
}
}
NS_IMETHODIMP

View File

@ -126,9 +126,6 @@ public:
// Possible values at nsIDOMMouseEvent
uint16_t inputSource;
// ID of the canvas HitRegion
nsString region;
void AssignMouseEventBaseData(const WidgetMouseEventBase& aEvent,
bool aCopyTargets)
{