Merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Razvan Maries 2019-01-16 19:00:15 +02:00
Родитель 51cdff0ef9 b44ff327e9
Коммит 4c67bec411
40 изменённых файлов: 583 добавлений и 445 удалений

Просмотреть файл

@ -10699,7 +10699,7 @@ PointerLockRequest::Run() {
if (!error && !mUserInputOrChromeCaller && !doc->GetFullscreenElement()) { if (!error && !mUserInputOrChromeCaller && !doc->GetFullscreenElement()) {
error = "PointerLockDeniedNotInputDriven"; error = "PointerLockDeniedNotInputDriven";
} }
if (!error && !doc->SetPointerLock(e, NS_STYLE_CURSOR_NONE)) { if (!error && !doc->SetPointerLock(e, StyleCursorKind::None)) {
error = "PointerLockDeniedFailedToLock"; error = "PointerLockDeniedFailedToLock";
} }
if (error) { if (error) {
@ -10737,7 +10737,7 @@ void Document::RequestPointerLock(Element* aElement, CallerType aCallerType) {
Dispatch(TaskCategory::Other, request.forget()); Dispatch(TaskCategory::Other, request.forget());
} }
bool Document::SetPointerLock(Element* aElement, int aCursorStyle) { bool Document::SetPointerLock(Element* aElement, StyleCursorKind aCursorStyle) {
MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this, MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this,
"We should be either unlocking pointer (aElement is nullptr), " "We should be either unlocking pointer (aElement is nullptr), "
"or locking pointer to an element in this document"); "or locking pointer to an element in this document");
@ -10797,7 +10797,7 @@ void Document::UnlockPointer(Document* aDoc) {
if (!pointerLockedDoc || (aDoc && aDoc != pointerLockedDoc)) { if (!pointerLockedDoc || (aDoc && aDoc != pointerLockedDoc)) {
return; return;
} }
if (!pointerLockedDoc->SetPointerLock(nullptr, NS_STYLE_CURSOR_AUTO)) { if (!pointerLockedDoc->SetPointerLock(nullptr, StyleCursorKind::Auto)) {
return; return;
} }

Просмотреть файл

@ -136,6 +136,7 @@ class FullscreenRequest;
class PendingAnimationTracker; class PendingAnimationTracker;
class ServoStyleSet; class ServoStyleSet;
class SMILAnimationController; class SMILAnimationController;
enum class StyleCursorKind : uint8_t;
template <typename> template <typename>
class OwningNonNull; class OwningNonNull;
struct URLExtraData; struct URLExtraData;
@ -1821,8 +1822,8 @@ class Document : public nsINode,
*/ */
static bool HandlePendingFullscreenRequests(Document* aDocument); static bool HandlePendingFullscreenRequests(Document* aDocument);
void RequestPointerLock(Element* aElement, mozilla::dom::CallerType); void RequestPointerLock(Element* aElement, CallerType);
bool SetPointerLock(Element* aElement, int aCursorStyle); bool SetPointerLock(Element* aElement, StyleCursorKind);
static void UnlockPointer(Document* aDoc = nullptr); static void UnlockPointer(Document* aDoc = nullptr);

Просмотреть файл

@ -7051,18 +7051,21 @@ nsIDOMWindowUtils* nsGlobalWindowOuter::WindowUtils() {
} }
// Note: This call will lock the cursor, it will not change as it moves. // Note: This call will lock the cursor, it will not change as it moves.
// To unlock, the cursor must be set back to CURSOR_AUTO. // To unlock, the cursor must be set back to Auto.
void nsGlobalWindowOuter::SetCursorOuter(const nsAString& aCursor, void nsGlobalWindowOuter::SetCursorOuter(const nsAString& aCursor,
ErrorResult& aError) { ErrorResult& aError) {
int32_t cursor; StyleCursorKind cursor;
if (aCursor.EqualsLiteral("auto")) if (aCursor.EqualsLiteral("auto")) {
cursor = NS_STYLE_CURSOR_AUTO; cursor = StyleCursorKind::Auto;
else { } else {
// TODO(emilio): Use Servo for this instead.
nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(aCursor); nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(aCursor);
if (!nsCSSProps::FindKeyword(keyword, nsCSSProps::kCursorKTable, cursor)) { int32_t c;
if (!nsCSSProps::FindKeyword(keyword, nsCSSProps::kCursorKTable, c)) {
return; return;
} }
cursor = static_cast<StyleCursorKind>(c);
} }
RefPtr<nsPresContext> presContext; RefPtr<nsPresContext> presContext;

Просмотреть файл

@ -221,12 +221,14 @@ bool EventStateManager::WheelPrefs::sHonoursRootForAutoDir = false;
EventStateManager::DeltaAccumulator* EventStateManager::DeltaAccumulator*
EventStateManager::DeltaAccumulator::sInstance = nullptr; EventStateManager::DeltaAccumulator::sInstance = nullptr;
constexpr const StyleCursorKind kInvalidCursorKind =
static_cast<StyleCursorKind>(255);
EventStateManager::EventStateManager() EventStateManager::EventStateManager()
: mLockCursor(0), : mLockCursor(kInvalidCursorKind),
mLastFrameConsumedSetCursor(false), mLastFrameConsumedSetCursor(false),
mCurrentTarget(nullptr) mCurrentTarget(nullptr),
// init d&d gesture state machine variables // init d&d gesture state machine variables
,
mGestureDownPoint(0, 0), mGestureDownPoint(0, 0),
mGestureModifiers(0), mGestureModifiers(0),
mGestureDownButtons(0), mGestureDownButtons(0),
@ -3612,13 +3614,13 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
return; return;
} }
int32_t cursor = NS_STYLE_CURSOR_DEFAULT; auto cursor = StyleCursorKind::Default;
imgIContainer* container = nullptr; imgIContainer* container = nullptr;
bool haveHotspot = false; bool haveHotspot = false;
float hotspotX = 0.0f, hotspotY = 0.0f; float hotspotX = 0.0f, hotspotY = 0.0f;
// If cursor is locked just use the locked one // If cursor is locked just use the locked one
if (mLockCursor) { if (mLockCursor != kInvalidCursorKind) {
cursor = mLockCursor; cursor = mLockCursor;
} }
// If not locked, look for correct cursor // If not locked, look for correct cursor
@ -3663,8 +3665,8 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
// Show busy cursor everywhere before page loads // Show busy cursor everywhere before page loads
// and just replace the arrow cursor after page starts loading // and just replace the arrow cursor after page starts loading
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY && if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY &&
(cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT)) { (cursor == StyleCursorKind::Auto || cursor == StyleCursorKind::Default)) {
cursor = NS_STYLE_CURSOR_SPINNING; cursor = StyleCursorKind::Progress;
container = nullptr; container = nullptr;
} }
} }
@ -3676,7 +3678,7 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
gLastCursorUpdateTime = TimeStamp::NowLoRes(); gLastCursorUpdateTime = TimeStamp::NowLoRes();
} }
if (mLockCursor || NS_STYLE_CURSOR_AUTO != cursor) { if (mLockCursor != kInvalidCursorKind || StyleCursorKind::Auto != cursor) {
*aStatus = nsEventStatus_eConsumeDoDefault; *aStatus = nsEventStatus_eConsumeDoDefault;
} }
} }
@ -3692,7 +3694,7 @@ void EventStateManager::ClearCachedWidgetCursor(nsIFrame* aTargetFrame) {
aWidget->ClearCachedCursor(); aWidget->ClearCachedCursor();
} }
nsresult EventStateManager::SetCursor(int32_t aCursor, nsresult EventStateManager::SetCursor(StyleCursorKind aCursor,
imgIContainer* aContainer, imgIContainer* aContainer,
bool aHaveHotspot, float aHotspotX, bool aHaveHotspot, float aHotspotX,
float aHotspotY, nsIWidget* aWidget, float aHotspotY, nsIWidget* aWidget,
@ -3705,119 +3707,119 @@ nsresult EventStateManager::SetCursor(int32_t aCursor,
NS_ENSURE_TRUE(aWidget, NS_ERROR_FAILURE); NS_ENSURE_TRUE(aWidget, NS_ERROR_FAILURE);
if (aLockCursor) { if (aLockCursor) {
if (NS_STYLE_CURSOR_AUTO != aCursor) { if (StyleCursorKind::Auto != aCursor) {
mLockCursor = aCursor; mLockCursor = aCursor;
} else { } else {
// If cursor style is set to auto we unlock the cursor again. // If cursor style is set to auto we unlock the cursor again.
mLockCursor = 0; mLockCursor = kInvalidCursorKind;
} }
} }
switch (aCursor) { switch (aCursor) {
default: default:
case NS_STYLE_CURSOR_AUTO: case StyleCursorKind::Auto:
case NS_STYLE_CURSOR_DEFAULT: case StyleCursorKind::Default:
c = eCursor_standard; c = eCursor_standard;
break; break;
case NS_STYLE_CURSOR_POINTER: case StyleCursorKind::Pointer:
c = eCursor_hyperlink; c = eCursor_hyperlink;
break; break;
case NS_STYLE_CURSOR_CROSSHAIR: case StyleCursorKind::Crosshair:
c = eCursor_crosshair; c = eCursor_crosshair;
break; break;
case NS_STYLE_CURSOR_MOVE: case StyleCursorKind::Move:
c = eCursor_move; c = eCursor_move;
break; break;
case NS_STYLE_CURSOR_TEXT: case StyleCursorKind::Text:
c = eCursor_select; c = eCursor_select;
break; break;
case NS_STYLE_CURSOR_WAIT: case StyleCursorKind::Wait:
c = eCursor_wait; c = eCursor_wait;
break; break;
case NS_STYLE_CURSOR_HELP: case StyleCursorKind::Help:
c = eCursor_help; c = eCursor_help;
break; break;
case NS_STYLE_CURSOR_N_RESIZE: case StyleCursorKind::NResize:
c = eCursor_n_resize; c = eCursor_n_resize;
break; break;
case NS_STYLE_CURSOR_S_RESIZE: case StyleCursorKind::SResize:
c = eCursor_s_resize; c = eCursor_s_resize;
break; break;
case NS_STYLE_CURSOR_W_RESIZE: case StyleCursorKind::WResize:
c = eCursor_w_resize; c = eCursor_w_resize;
break; break;
case NS_STYLE_CURSOR_E_RESIZE: case StyleCursorKind::EResize:
c = eCursor_e_resize; c = eCursor_e_resize;
break; break;
case NS_STYLE_CURSOR_NW_RESIZE: case StyleCursorKind::NwResize:
c = eCursor_nw_resize; c = eCursor_nw_resize;
break; break;
case NS_STYLE_CURSOR_SE_RESIZE: case StyleCursorKind::SeResize:
c = eCursor_se_resize; c = eCursor_se_resize;
break; break;
case NS_STYLE_CURSOR_NE_RESIZE: case StyleCursorKind::NeResize:
c = eCursor_ne_resize; c = eCursor_ne_resize;
break; break;
case NS_STYLE_CURSOR_SW_RESIZE: case StyleCursorKind::SwResize:
c = eCursor_sw_resize; c = eCursor_sw_resize;
break; break;
case NS_STYLE_CURSOR_COPY: // CSS3 case StyleCursorKind::Copy: // CSS3
c = eCursor_copy; c = eCursor_copy;
break; break;
case NS_STYLE_CURSOR_ALIAS: case StyleCursorKind::Alias:
c = eCursor_alias; c = eCursor_alias;
break; break;
case NS_STYLE_CURSOR_CONTEXT_MENU: case StyleCursorKind::ContextMenu:
c = eCursor_context_menu; c = eCursor_context_menu;
break; break;
case NS_STYLE_CURSOR_CELL: case StyleCursorKind::Cell:
c = eCursor_cell; c = eCursor_cell;
break; break;
case NS_STYLE_CURSOR_GRAB: case StyleCursorKind::Grab:
c = eCursor_grab; c = eCursor_grab;
break; break;
case NS_STYLE_CURSOR_GRABBING: case StyleCursorKind::Grabbing:
c = eCursor_grabbing; c = eCursor_grabbing;
break; break;
case NS_STYLE_CURSOR_SPINNING: case StyleCursorKind::Progress:
c = eCursor_spinning; c = eCursor_spinning;
break; break;
case NS_STYLE_CURSOR_ZOOM_IN: case StyleCursorKind::ZoomIn:
c = eCursor_zoom_in; c = eCursor_zoom_in;
break; break;
case NS_STYLE_CURSOR_ZOOM_OUT: case StyleCursorKind::ZoomOut:
c = eCursor_zoom_out; c = eCursor_zoom_out;
break; break;
case NS_STYLE_CURSOR_NOT_ALLOWED: case StyleCursorKind::NotAllowed:
c = eCursor_not_allowed; c = eCursor_not_allowed;
break; break;
case NS_STYLE_CURSOR_COL_RESIZE: case StyleCursorKind::ColResize:
c = eCursor_col_resize; c = eCursor_col_resize;
break; break;
case NS_STYLE_CURSOR_ROW_RESIZE: case StyleCursorKind::RowResize:
c = eCursor_row_resize; c = eCursor_row_resize;
break; break;
case NS_STYLE_CURSOR_NO_DROP: case StyleCursorKind::NoDrop:
c = eCursor_no_drop; c = eCursor_no_drop;
break; break;
case NS_STYLE_CURSOR_VERTICAL_TEXT: case StyleCursorKind::VerticalText:
c = eCursor_vertical_text; c = eCursor_vertical_text;
break; break;
case NS_STYLE_CURSOR_ALL_SCROLL: case StyleCursorKind::AllScroll:
c = eCursor_all_scroll; c = eCursor_all_scroll;
break; break;
case NS_STYLE_CURSOR_NESW_RESIZE: case StyleCursorKind::NeswResize:
c = eCursor_nesw_resize; c = eCursor_nesw_resize;
break; break;
case NS_STYLE_CURSOR_NWSE_RESIZE: case StyleCursorKind::NwseResize:
c = eCursor_nwse_resize; c = eCursor_nwse_resize;
break; break;
case NS_STYLE_CURSOR_NS_RESIZE: case StyleCursorKind::NsResize:
c = eCursor_ns_resize; c = eCursor_ns_resize;
break; break;
case NS_STYLE_CURSOR_EW_RESIZE: case StyleCursorKind::EwResize:
c = eCursor_ew_resize; c = eCursor_ew_resize;
break; break;
case NS_STYLE_CURSOR_NONE: case StyleCursorKind::None:
c = eCursor_none; c = eCursor_none;
break; break;
} }

Просмотреть файл

@ -231,7 +231,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
bool CheckIfEventMatchesAccessKey(WidgetKeyboardEvent* aEvent, bool CheckIfEventMatchesAccessKey(WidgetKeyboardEvent* aEvent,
nsPresContext* aPresContext); nsPresContext* aPresContext);
nsresult SetCursor(int32_t aCursor, imgIContainer* aContainer, nsresult SetCursor(StyleCursorKind aCursor, imgIContainer* aContainer,
bool aHaveHotspot, float aHotspotX, float aHotspotY, bool aHaveHotspot, float aHotspotX, float aHotspotY,
nsIWidget* aWidget, bool aLockCursor); nsIWidget* aWidget, bool aLockCursor);
@ -1171,7 +1171,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
already_AddRefed<EventStateManager> ESMFromContentOrThis( already_AddRefed<EventStateManager> ESMFromContentOrThis(
nsIContent* aContent); nsIContent* aContent);
int32_t mLockCursor; StyleCursorKind mLockCursor;
bool mLastFrameConsumedSetCursor; bool mLastFrameConsumedSetCursor;
// Last mouse event mRefPoint (the offset from the widget's origin in // Last mouse event mRefPoint (the offset from the widget's origin in

Просмотреть файл

@ -16,6 +16,14 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsRegion.h" #include "nsRegion.h"
namespace mozilla {
namespace gfx {
class FilterPrimitiveDescription;
} // namespace gfx
} // namespace mozilla
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::gfx::FilterPrimitiveDescription)
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
@ -461,10 +469,10 @@ class FilterPrimitiveDescription final {
private: private:
PrimitiveAttributes mAttributes; PrimitiveAttributes mAttributes;
nsTArray<int32_t> mInputPrimitives; AutoTArray<int32_t, 2> mInputPrimitives;
IntRect mFilterPrimitiveSubregion; IntRect mFilterPrimitiveSubregion;
IntRect mFilterSpaceBounds; IntRect mFilterSpaceBounds;
nsTArray<ColorSpace> mInputColorSpaces; AutoTArray<ColorSpace, 2> mInputColorSpaces;
ColorSpace mOutputColorSpace; ColorSpace mOutputColorSpace;
bool mIsTainted; bool mIsTainted;
}; };

Просмотреть файл

@ -102,7 +102,7 @@ skip-if = os == 'android'
[test_animSVGImage.html] [test_animSVGImage.html]
skip-if = os == 'android' || os == 'win' # Bug 1370784 skip-if = os == 'android' || os == 'win' # Bug 1370784
[test_animSVGImage2.html] [test_animSVGImage2.html]
skip-if = os == 'android' || (webrender && os == 'win') #Bug 1354561 skip-if = os == 'android' || (webrender && os == 'win') || (webrender && os == 'linux') #Bug 1354561
[test_background_image_anim.html] [test_background_image_anim.html]
skip-if = os == 'android' skip-if = os == 'android'
[test_bug399925.html] [test_bug399925.html]

Просмотреть файл

@ -0,0 +1,118 @@
// Various tests for unaligned float accesses. These are specifically meant to
// test the SIGBUS handling on 32-bit ARM by exercising odd addresses and odd
// offsets.
// For a triple of (numBallast, ty, offset), create the text for a pair of
// functions "get_ty_offset" and "set_ty_offset" where each has numBallast live
// dummy values across the operation of interest to force the use of different
// register numbers. (This is primarily for the FP registers as ARM code
// generation currently always uses the same scratch register for the base
// address of the access.)
//
// These must be augmented with a memory. Memory addresses 0-255 are reserved
// for internal use by these functions. The memory must start as zero.
function makeLoadStore(numBallast, ty, offset) {
// The general idea of the ballast is that we occupy some FP registers and
// some int registers with non-dead values before we perform an operation,
// and then we consume the occupied registers after.
//
// In the case of load, the loaded result is stored back in memory before we
// consume the ballast, thus the ion regalloc will not simply always load
// the result into d0, but usually into some temp other than d0. Thus the
// amount of ballast affects the register. (Ditto baseline though the
// reasoning is simpler.)
//
// In the case of store, we keep the parameter value live until the end so
// that the tmp that we compute for the store is moved into a different
// register. The tmp has the same value as the parameter value but a
// non-JIT compiler can't know that.
let loadtxt =
`(func (export "get_${ty}_${offset}") (param $p i32) (result ${ty})
${ballast(() => `
(i32.const 8)
(i32.store (i32.const 8) (i32.add (i32.load (i32.const 8)) (i32.const 1)))
(${ty}.load (i32.const 8))`)}
(${ty}.store (i32.const 0) (${ty}.load offset=${offset} (get_local $p)))
${ballast(() => `
${ty}.store`)}
(${ty}.load (i32.const 0)))`;
// This will assume the value at mem[16] is zero.
let storetxt =
`(func (export "set_${ty}_${offset}") (param $p i32) (param $v ${ty})
(local $tmp ${ty})
${ballast(() => `
(i32.const 8)
(i32.store (i32.const 8) (i32.add (i32.load (i32.const 8)) (i32.const 1)))
(${ty}.load (i32.const 8))`)}
(set_local $tmp (${ty}.add (get_local $v) (${ty}.load (i32.const 16))))
(${ty}.store offset=${offset} (get_local $p) (get_local $tmp))
${ballast(() => `
${ty}.store`)}
(${ty}.store (i32.const 8) (get_local $v)))`;
return `${loadtxt}
${storetxt}`;
function ballast(thunk) {
let s = "";
for ( let i=0 ; i < numBallast; i++ )
s += thunk();
return s;
}
}
// The complexity here comes from trying to force the source/target FP registers
// in the FP access instruction to vary. For Baseline this is not hard; for Ion
// trickier.
function makeInstance(numBallast, offset) {
let txt =
`(module
(memory (export "memory") 1 1)
${makeLoadStore(numBallast, 'f64', offset)}
${makeLoadStore(numBallast, 'f32', offset)})`;
return new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(txt)));
}
// `offset` corresponds to the "offset" directive in the instruction
for ( let offset=0 ; offset < 8; offset++ ) {
// `numBallast` represents the amount of ballast registers we're trying to use,
// see comments above.
for ( let numBallast=0; numBallast < 16; numBallast++ ) {
let ins = makeInstance(numBallast, offset);
let mem = ins.exports.memory;
let buf = new DataView(mem.buffer);
// `i` represents the offset in the pointer from a proper boundary
for ( let i=0; i < 9; i++ ) {
let offs = 256+i;
let val = Math.PI+i;
buf.setFloat64(offs + offset, val, true);
assertEq(ins.exports["get_f64_" + offset](offs), val);
ins.exports["set_f64_" + offset](offs + 32, val);
assertEq(buf.getFloat64(offs + 32 + offset, true), val);
}
for ( let i=0; i < 9; i++ ) {
let offs = 512+i;
let val = Math.fround(Math.PI+i);
buf.setFloat32(offs + offset, val, true);
assertEq(ins.exports["get_f32_" + offset](offs), val);
ins.exports["set_f32_" + offset](offs + 32, val);
assertEq(buf.getFloat32(offs + 32 + offset, true), val);
}
}
}

Просмотреть файл

@ -1,5 +1,3 @@
// |jit-test| skip-if: getBuildConfiguration()['arm']
// skip due to bug 1517351
// address.wast:3 // address.wast:3
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8a\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7f\x60\x01\x7f\x00\x03\x9f\x80\x80\x80\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\xcd\x82\x80\x80\x00\x1e\x08\x38\x75\x5f\x67\x6f\x6f\x64\x31\x00\x00\x08\x38\x75\x5f\x67\x6f\x6f\x64\x32\x00\x01\x08\x38\x75\x5f\x67\x6f\x6f\x64\x33\x00\x02\x08\x38\x75\x5f\x67\x6f\x6f\x64\x34\x00\x03\x08\x38\x75\x5f\x67\x6f\x6f\x64\x35\x00\x04\x08\x38\x73\x5f\x67\x6f\x6f\x64\x31\x00\x05\x08\x38\x73\x5f\x67\x6f\x6f\x64\x32\x00\x06\x08\x38\x73\x5f\x67\x6f\x6f\x64\x33\x00\x07\x08\x38\x73\x5f\x67\x6f\x6f\x64\x34\x00\x08\x08\x38\x73\x5f\x67\x6f\x6f\x64\x35\x00\x09\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x31\x00\x0a\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x32\x00\x0b\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x33\x00\x0c\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x34\x00\x0d\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x35\x00\x0e\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x31\x00\x0f\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x32\x00\x10\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x33\x00\x11\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x34\x00\x12\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x35\x00\x13\x08\x33\x32\x5f\x67\x6f\x6f\x64\x31\x00\x14\x08\x33\x32\x5f\x67\x6f\x6f\x64\x32\x00\x15\x08\x33\x32\x5f\x67\x6f\x6f\x64\x33\x00\x16\x08\x33\x32\x5f\x67\x6f\x6f\x64\x34\x00\x17\x08\x33\x32\x5f\x67\x6f\x6f\x64\x35\x00\x18\x06\x38\x75\x5f\x62\x61\x64\x00\x19\x06\x38\x73\x5f\x62\x61\x64\x00\x1a\x07\x31\x36\x75\x5f\x62\x61\x64\x00\x1b\x07\x31\x36\x73\x5f\x62\x61\x64\x00\x1c\x06\x33\x32\x5f\x62\x61\x64\x00\x1d\x0a\x82\x83\x80\x80\x00\x1e\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x02\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x02\x19\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2d\x00\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2c\x00\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2f\x01\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2e\x01\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x28\x02\xff\xff\xff\xff\x0f\x1a\x0b\x0b\xa0\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x1a\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a"); let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8a\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7f\x60\x01\x7f\x00\x03\x9f\x80\x80\x80\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\xcd\x82\x80\x80\x00\x1e\x08\x38\x75\x5f\x67\x6f\x6f\x64\x31\x00\x00\x08\x38\x75\x5f\x67\x6f\x6f\x64\x32\x00\x01\x08\x38\x75\x5f\x67\x6f\x6f\x64\x33\x00\x02\x08\x38\x75\x5f\x67\x6f\x6f\x64\x34\x00\x03\x08\x38\x75\x5f\x67\x6f\x6f\x64\x35\x00\x04\x08\x38\x73\x5f\x67\x6f\x6f\x64\x31\x00\x05\x08\x38\x73\x5f\x67\x6f\x6f\x64\x32\x00\x06\x08\x38\x73\x5f\x67\x6f\x6f\x64\x33\x00\x07\x08\x38\x73\x5f\x67\x6f\x6f\x64\x34\x00\x08\x08\x38\x73\x5f\x67\x6f\x6f\x64\x35\x00\x09\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x31\x00\x0a\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x32\x00\x0b\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x33\x00\x0c\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x34\x00\x0d\x09\x31\x36\x75\x5f\x67\x6f\x6f\x64\x35\x00\x0e\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x31\x00\x0f\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x32\x00\x10\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x33\x00\x11\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x34\x00\x12\x09\x31\x36\x73\x5f\x67\x6f\x6f\x64\x35\x00\x13\x08\x33\x32\x5f\x67\x6f\x6f\x64\x31\x00\x14\x08\x33\x32\x5f\x67\x6f\x6f\x64\x32\x00\x15\x08\x33\x32\x5f\x67\x6f\x6f\x64\x33\x00\x16\x08\x33\x32\x5f\x67\x6f\x6f\x64\x34\x00\x17\x08\x33\x32\x5f\x67\x6f\x6f\x64\x35\x00\x18\x06\x38\x75\x5f\x62\x61\x64\x00\x19\x06\x38\x73\x5f\x62\x61\x64\x00\x1a\x07\x31\x36\x75\x5f\x62\x61\x64\x00\x1b\x07\x31\x36\x73\x5f\x62\x61\x64\x00\x1c\x06\x33\x32\x5f\x62\x61\x64\x00\x1d\x0a\x82\x83\x80\x80\x00\x1e\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2c\x00\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2f\x01\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2e\x01\x19\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x02\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x00\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x01\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x28\x02\x19\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2d\x00\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2c\x00\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2f\x01\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x2e\x01\xff\xff\xff\xff\x0f\x1a\x0b\x8c\x80\x80\x80\x00\x00\x20\x00\x28\x02\xff\xff\xff\xff\x0f\x1a\x0b\x0b\xa0\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x1a\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a");

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,5 +1,3 @@
// |jit-test| skip-if: getBuildConfiguration()['arm']
// skip arm7 due to bug 1513231
// float_memory.wast:5 // float_memory.wast:5
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x03\x60\x00\x01\x7d\x60\x00\x01\x7f\x60\x00\x00\x03\x86\x80\x80\x80\x00\x05\x00\x01\x02\x02\x02\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\xb7\x80\x80\x80\x00\x05\x08\x66\x33\x32\x2e\x6c\x6f\x61\x64\x00\x00\x08\x69\x33\x32\x2e\x6c\x6f\x61\x64\x00\x01\x09\x66\x33\x32\x2e\x73\x74\x6f\x72\x65\x00\x02\x09\x69\x33\x32\x2e\x73\x74\x6f\x72\x65\x00\x03\x05\x72\x65\x73\x65\x74\x00\x04\x0a\xca\x80\x80\x80\x00\x05\x87\x80\x80\x80\x00\x00\x41\x00\x2a\x02\x00\x0b\x87\x80\x80\x80\x00\x00\x41\x00\x28\x02\x00\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x43\x00\x00\xa0\x7f\x38\x02\x00\x0b\x8d\x80\x80\x80\x00\x00\x41\x00\x41\x80\x80\x80\xfd\x07\x36\x02\x00\x0b\x89\x80\x80\x80\x00\x00\x41\x00\x41\x00\x36\x02\x00\x0b\x0b\x8a\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x04\x00\x00\xa0\x7f"); let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x03\x60\x00\x01\x7d\x60\x00\x01\x7f\x60\x00\x00\x03\x86\x80\x80\x80\x00\x05\x00\x01\x02\x02\x02\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\xb7\x80\x80\x80\x00\x05\x08\x66\x33\x32\x2e\x6c\x6f\x61\x64\x00\x00\x08\x69\x33\x32\x2e\x6c\x6f\x61\x64\x00\x01\x09\x66\x33\x32\x2e\x73\x74\x6f\x72\x65\x00\x02\x09\x69\x33\x32\x2e\x73\x74\x6f\x72\x65\x00\x03\x05\x72\x65\x73\x65\x74\x00\x04\x0a\xca\x80\x80\x80\x00\x05\x87\x80\x80\x80\x00\x00\x41\x00\x2a\x02\x00\x0b\x87\x80\x80\x80\x00\x00\x41\x00\x28\x02\x00\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x43\x00\x00\xa0\x7f\x38\x02\x00\x0b\x8d\x80\x80\x80\x00\x00\x41\x00\x41\x80\x80\x80\xfd\x07\x36\x02\x00\x0b\x89\x80\x80\x80\x00\x00\x41\x00\x41\x00\x36\x02\x00\x0b\x0b\x8a\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x04\x00\x00\xa0\x7f");

Просмотреть файл

@ -1,5 +1,3 @@
// |jit-test| skip-if: getBuildConfiguration()['arm']
// skip arm7 due to bug 1513231
// memory_redundancy.wast:5 // memory_redundancy.wast:5
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x91\x80\x80\x80\x00\x04\x60\x00\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x03\x87\x80\x80\x80\x00\x06\x00\x01\x01\x02\x03\x01\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\xeb\x80\x80\x80\x00\x06\x0f\x7a\x65\x72\x6f\x5f\x65\x76\x65\x72\x79\x74\x68\x69\x6e\x67\x00\x00\x12\x74\x65\x73\x74\x5f\x73\x74\x6f\x72\x65\x5f\x74\x6f\x5f\x6c\x6f\x61\x64\x00\x01\x13\x74\x65\x73\x74\x5f\x72\x65\x64\x75\x6e\x64\x61\x6e\x74\x5f\x6c\x6f\x61\x64\x00\x02\x0f\x74\x65\x73\x74\x5f\x64\x65\x61\x64\x5f\x73\x74\x6f\x72\x65\x00\x03\x06\x6d\x61\x6c\x6c\x6f\x63\x00\x04\x0f\x6d\x61\x6c\x6c\x6f\x63\x5f\x61\x6c\x69\x61\x73\x69\x6e\x67\x00\x05\x0a\xbd\x81\x80\x80\x00\x06\x9e\x80\x80\x80\x00\x00\x41\x00\x41\x00\x36\x02\x00\x41\x04\x41\x00\x36\x02\x00\x41\x08\x41\x00\x36\x02\x00\x41\x0c\x41\x00\x36\x02\x00\x0b\x98\x80\x80\x80\x00\x00\x41\x08\x41\x00\x36\x02\x00\x41\x05\x43\x00\x00\x00\x80\x38\x02\x00\x41\x08\x28\x02\x00\x0b\xa2\x80\x80\x80\x00\x01\x02\x7f\x41\x08\x28\x02\x00\x21\x00\x41\x05\x41\x80\x80\x80\x80\x78\x36\x02\x00\x41\x08\x28\x02\x00\x21\x01\x20\x00\x20\x01\x6a\x0b\x9f\x80\x80\x80\x00\x01\x01\x7d\x41\x08\x41\xa3\xc6\x8c\x99\x02\x36\x02\x00\x41\x0b\x2a\x02\x00\x21\x00\x41\x08\x41\x00\x36\x02\x00\x20\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x10\x0b\xa3\x80\x80\x80\x00\x01\x02\x7f\x41\x04\x10\x04\x21\x00\x41\x04\x10\x04\x21\x01\x20\x00\x41\x2a\x36\x02\x00\x20\x01\x41\x2b\x36\x02\x00\x20\x00\x28\x02\x00\x0b"); let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x91\x80\x80\x80\x00\x04\x60\x00\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x03\x87\x80\x80\x80\x00\x06\x00\x01\x01\x02\x03\x01\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\xeb\x80\x80\x80\x00\x06\x0f\x7a\x65\x72\x6f\x5f\x65\x76\x65\x72\x79\x74\x68\x69\x6e\x67\x00\x00\x12\x74\x65\x73\x74\x5f\x73\x74\x6f\x72\x65\x5f\x74\x6f\x5f\x6c\x6f\x61\x64\x00\x01\x13\x74\x65\x73\x74\x5f\x72\x65\x64\x75\x6e\x64\x61\x6e\x74\x5f\x6c\x6f\x61\x64\x00\x02\x0f\x74\x65\x73\x74\x5f\x64\x65\x61\x64\x5f\x73\x74\x6f\x72\x65\x00\x03\x06\x6d\x61\x6c\x6c\x6f\x63\x00\x04\x0f\x6d\x61\x6c\x6c\x6f\x63\x5f\x61\x6c\x69\x61\x73\x69\x6e\x67\x00\x05\x0a\xbd\x81\x80\x80\x00\x06\x9e\x80\x80\x80\x00\x00\x41\x00\x41\x00\x36\x02\x00\x41\x04\x41\x00\x36\x02\x00\x41\x08\x41\x00\x36\x02\x00\x41\x0c\x41\x00\x36\x02\x00\x0b\x98\x80\x80\x80\x00\x00\x41\x08\x41\x00\x36\x02\x00\x41\x05\x43\x00\x00\x00\x80\x38\x02\x00\x41\x08\x28\x02\x00\x0b\xa2\x80\x80\x80\x00\x01\x02\x7f\x41\x08\x28\x02\x00\x21\x00\x41\x05\x41\x80\x80\x80\x80\x78\x36\x02\x00\x41\x08\x28\x02\x00\x21\x01\x20\x00\x20\x01\x6a\x0b\x9f\x80\x80\x80\x00\x01\x01\x7d\x41\x08\x41\xa3\xc6\x8c\x99\x02\x36\x02\x00\x41\x0b\x2a\x02\x00\x21\x00\x41\x08\x41\x00\x36\x02\x00\x20\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x10\x0b\xa3\x80\x80\x80\x00\x01\x02\x7f\x41\x04\x10\x04\x21\x00\x41\x04\x10\x04\x21\x01\x20\x00\x41\x2a\x36\x02\x00\x20\x01\x41\x2b\x36\x02\x00\x20\x00\x28\x02\x00\x0b");

Просмотреть файл

@ -5907,6 +5907,8 @@ void MacroAssemblerARM::wasmLoadImpl(const wasm::MemoryAccessDesc& access,
ScratchRegisterScope scratch(asMasm()); ScratchRegisterScope scratch(asMasm());
ma_add(memoryBase, ptr, scratch); ma_add(memoryBase, ptr, scratch);
// See HandleUnalignedTrap() in WasmSignalHandler.cpp. We depend on this
// being a single, unconditional VLDR with a base pointer other than PC.
load = ma_vldr(Operand(Address(scratch, 0)).toVFPAddr(), output.fpu()); load = ma_vldr(Operand(Address(scratch, 0)).toVFPAddr(), output.fpu());
append(access, load.getOffset()); append(access, load.getOffset());
} else { } else {
@ -5961,6 +5963,8 @@ void MacroAssemblerARM::wasmStoreImpl(const wasm::MemoryAccessDesc& access,
MOZ_ASSERT((byteSize == 4) == val.isSingle()); MOZ_ASSERT((byteSize == 4) == val.isSingle());
ma_add(memoryBase, ptr, scratch); ma_add(memoryBase, ptr, scratch);
// See HandleUnalignedTrap() in WasmSignalHandler.cpp. We depend on this
// being a single, unconditional VLDR with a base pointer other than PC.
store = ma_vstr(val, Operand(Address(scratch, 0)).toVFPAddr()); store = ma_vstr(val, Operand(Address(scratch, 0)).toVFPAddr());
append(access, store.getOffset()); append(access, store.getOffset());
} else { } else {

Просмотреть файл

@ -1143,6 +1143,36 @@ bool Instance::memoryAccessInGuardRegion(uint8_t* addr,
lastByteOffset < memoryMappedSize(); lastByteOffset < memoryMappedSize();
} }
bool Instance::memoryAccessInBounds(uint8_t* addr,
unsigned numBytes) const {
MOZ_ASSERT(numBytes > 0 && numBytes <= sizeof(double));
if (!metadata().usesMemory()) {
return false;
}
uint8_t* base = memoryBase().unwrap(/* comparison */);
if (addr < base) {
return false;
}
uint32_t length = memory()->volatileMemoryLength();
if (addr >= base + length) {
return false;
}
// The pointer points into the memory. Now check for partial OOB.
//
// This calculation can't wrap around because the access is small and there
// always is a guard page following the memory.
size_t lastByteOffset = addr - base + (numBytes - 1);
if (lastByteOffset >= length) {
return false;
}
return true;
}
void Instance::tracePrivate(JSTracer* trc) { void Instance::tracePrivate(JSTracer* trc) {
// This method is only called from WasmInstanceObject so the only reason why // This method is only called from WasmInstanceObject so the only reason why
// TraceEdge is called is so that the pointer can be updated during a moving // TraceEdge is called is so that the pointer can be updated during a moving

Просмотреть файл

@ -113,6 +113,7 @@ class Instance {
size_t memoryMappedSize() const; size_t memoryMappedSize() const;
SharedArrayRawBuffer* sharedMemoryBuffer() const; // never null SharedArrayRawBuffer* sharedMemoryBuffer() const; // never null
bool memoryAccessInGuardRegion(uint8_t* addr, unsigned numBytes) const; bool memoryAccessInGuardRegion(uint8_t* addr, unsigned numBytes) const;
bool memoryAccessInBounds(uint8_t* addr, unsigned numBytes) const;
const StructTypeVector& structTypes() const { return code_->structTypes(); } const StructTypeVector& structTypes() const { return code_->structTypes(); }
static constexpr size_t offsetOfJSJitArgsRectifier() { static constexpr size_t offsetOfJSJitArgsRectifier() {

Просмотреть файл

@ -213,6 +213,10 @@ using mozilla::DebugOnly;
#error "Don't know how to read/write to the thread state via the mcontext_t." #error "Don't know how to read/write to the thread state via the mcontext_t."
#endif #endif
#if defined(__linux__) && defined(__arm__)
#include <sys/user.h>
#endif
#if defined(ANDROID) #if defined(ANDROID)
// Not all versions of the Android NDK define ucontext_t or mcontext_t. // Not all versions of the Android NDK define ucontext_t or mcontext_t.
// Detect this and provide custom but compatible definitions. Note that these // Detect this and provide custom but compatible definitions. Note that these
@ -437,7 +441,197 @@ struct AutoHandlingTrap {
} }
}; };
#if defined(__linux__) && defined(__arm__)
// Code to handle SIGBUS for unaligned floating point accesses on 32-bit ARM.
static uintptr_t ReadGPR(CONTEXT* context, uint32_t rn) {
switch (rn) {
case 0: return context->uc_mcontext.arm_r0;
case 1: return context->uc_mcontext.arm_r1;
case 2: return context->uc_mcontext.arm_r2;
case 3: return context->uc_mcontext.arm_r3;
case 4: return context->uc_mcontext.arm_r4;
case 5: return context->uc_mcontext.arm_r5;
case 6: return context->uc_mcontext.arm_r6;
case 7: return context->uc_mcontext.arm_r7;
case 8: return context->uc_mcontext.arm_r8;
case 9: return context->uc_mcontext.arm_r9;
case 10: return context->uc_mcontext.arm_r10;
case 11: return context->uc_mcontext.arm_fp;
case 12: return context->uc_mcontext.arm_ip;
case 13: return context->uc_mcontext.arm_sp;
case 14: return context->uc_mcontext.arm_lr;
case 15: return context->uc_mcontext.arm_pc;
default: MOZ_CRASH();
}
}
// Linux kernel data structures.
//
// The vfp_sigframe is a kernel type overlaid on the uc_regspace field of the
// ucontext_t if the first word of the uc_regspace is VFP_MAGIC. (user_vfp and
// user_vfp_exc are defined in sys/user.h and are stable.)
//
// VFP_MAGIC appears to have been stable since a commit to Linux on 2010-04-11,
// when it was changed from being 0x56465001 on ARMv6 and earlier and 0x56465002
// on ARMv7 and later, to being 0x56465001 on all CPU versions. This was in
// Kernel 2.6.34-rc5.
//
// My best interpretation of the Android commit history is that Android has had
// vfp_sigframe and VFP_MAGIC in this form since at least Android 3.4 / 2012;
// Firefox requires Android 4.0 at least and we're probably safe here.
struct vfp_sigframe
{
unsigned long magic;
unsigned long size;
struct user_vfp ufp;
struct user_vfp_exc ufp_exc;
};
#define VFP_MAGIC 0x56465001
static vfp_sigframe* GetVFPFrame(CONTEXT* context) {
if (context->uc_regspace[0] != VFP_MAGIC) {
return nullptr;
}
return (vfp_sigframe*)&context->uc_regspace;
}
static bool ReadFPR64(CONTEXT* context, uint32_t vd, double* val) {
MOZ_ASSERT(vd < 32);
vfp_sigframe* frame = GetVFPFrame(context);
if (frame) {
*val = ((double*)frame->ufp.fpregs)[vd];
return true;
}
return false;
}
static bool WriteFPR64(CONTEXT* context, uint32_t vd, double val) {
MOZ_ASSERT(vd < 32);
vfp_sigframe* frame = GetVFPFrame(context);
if (frame) {
((double*)frame->ufp.fpregs)[vd] = val;
return true;
}
return false;
}
static bool ReadFPR32(CONTEXT* context, uint32_t vd, float* val) {
MOZ_ASSERT(vd < 32);
vfp_sigframe* frame = GetVFPFrame(context);
if (frame) {
*val = ((float*)frame->ufp.fpregs)[vd];
return true;
}
return false;
}
static bool WriteFPR32(CONTEXT* context, uint32_t vd, float val) {
MOZ_ASSERT(vd < 32);
vfp_sigframe* frame = GetVFPFrame(context);
if (frame) {
((float*)frame->ufp.fpregs)[vd] = val;
return true;
}
return false;
}
static bool HandleUnalignedTrap(CONTEXT* context, uint8_t* pc,
Instance* instance) {
// ARM only, no Thumb.
MOZ_RELEASE_ASSERT(uintptr_t(pc) % 4 == 0);
// wasmLoadImpl() and wasmStoreImpl() in MacroAssembler-arm.cpp emit plain,
// unconditional VLDR and VSTR instructions that do not use the PC as the base
// register.
uint32_t instr = *(uint32_t*)pc;
uint32_t masked = instr & 0x0F300E00;
bool isVLDR = masked == 0x0D100A00;
bool isVSTR = masked == 0x0D000A00;
if (!isVLDR && !isVSTR) {
// Three obvious cases if we don't get our expected instructions:
// - masm is generating other FP access instructions than it should
// - we're encountering a device that traps on new kinds of accesses,
// perhaps unaligned integer accesses
// - general code generation bugs that lead to SIGBUS
# ifdef ANDROID
__android_log_print(ANDROID_LOG_ERROR, "WASM", "Bad SIGBUS instr %08x", instr);
# endif
# ifdef DEBUG
MOZ_CRASH("Unexpected instruction");
# endif
return false;
}
bool isUnconditional = (instr >> 28) == 0xE;
bool isDouble = (instr & 0x00000100) != 0;
bool isAdd = (instr & 0x00800000) != 0;
uint32_t dBit = (instr >> 22) & 1;
uint32_t offs = (instr & 0xFF) << 2;
uint32_t rn = (instr >> 16) & 0xF;
MOZ_RELEASE_ASSERT(isUnconditional);
MOZ_RELEASE_ASSERT(rn != 15);
uint8_t* p = (uint8_t*)ReadGPR(context, rn) + (isAdd ? offs : -offs);
if (!instance->memoryAccessInBounds(p, isDouble ? sizeof(double)
: sizeof(float))) {
return false;
}
if (isDouble) {
uint32_t vd = ((instr >> 12) & 0xF) | (dBit << 4);
double val;
if (isVLDR) {
memcpy(&val, p, sizeof(val));
if (WriteFPR64(context, vd, val)) {
SetContextPC(context, pc + 4);
return true;
}
} else {
if (ReadFPR64(context, vd, &val)) {
memcpy(p, &val, sizeof(val));
SetContextPC(context, pc + 4);
return true;
}
}
} else {
uint32_t vd = ((instr >> 11) & (0xF << 1)) | dBit;
float val;
if (isVLDR) {
memcpy(&val, p, sizeof(val));
if (WriteFPR32(context, vd, val)) {
SetContextPC(context, pc + 4);
return true;
}
} else {
if (ReadFPR32(context, vd, &val)) {
memcpy(p, &val, sizeof(val));
SetContextPC(context, pc + 4);
return true;
}
}
}
#ifdef DEBUG
MOZ_CRASH("SIGBUS handler could not access FP register, incompatible kernel?");
#endif
return false;
}
#else // __linux__ && __arm__
static bool HandleUnalignedTrap(CONTEXT* context, uint8_t* pc,
Instance* instance) {
return false;
}
#endif // __linux__ && __arm__
static MOZ_MUST_USE bool HandleTrap(CONTEXT* context, static MOZ_MUST_USE bool HandleTrap(CONTEXT* context,
bool isUnalignedSignal = false,
JSContext* assertCx = nullptr) { JSContext* assertCx = nullptr) {
MOZ_ASSERT(sAlreadyHandlingTrap.get()); MOZ_ASSERT(sAlreadyHandlingTrap.get());
@ -463,6 +657,16 @@ static MOZ_MUST_USE bool HandleTrap(CONTEXT* context,
Instance* instance = ((Frame*)ContextToFP(context))->tls->instance; Instance* instance = ((Frame*)ContextToFP(context))->tls->instance;
MOZ_RELEASE_ASSERT(&instance->code() == &segment.code() || MOZ_RELEASE_ASSERT(&instance->code() == &segment.code() ||
trap == Trap::IndirectCallBadSig); trap == Trap::IndirectCallBadSig);
if (isUnalignedSignal) {
if (trap != Trap::OutOfBounds) {
return false;
}
if (HandleUnalignedTrap(context, pc, instance)) {
return true;
}
}
JSContext* cx = JSContext* cx =
instance->realm()->runtimeFromAnyThread()->mainContextFromAnyThread(); instance->realm()->runtimeFromAnyThread()->mainContextFromAnyThread();
MOZ_RELEASE_ASSERT(!assertCx || cx == assertCx); MOZ_RELEASE_ASSERT(!assertCx || cx == assertCx);
@ -503,7 +707,7 @@ static LONG WINAPI WasmTrapHandler(LPEXCEPTION_POINTERS exception) {
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
if (!HandleTrap(exception->ContextRecord, TlsContext.get())) { if (!HandleTrap(exception->ContextRecord, false, TlsContext.get())) {
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
@ -671,7 +875,7 @@ static void WasmTrapHandler(int signum, siginfo_t* info, void* context) {
AutoHandlingTrap aht; AutoHandlingTrap aht;
MOZ_RELEASE_ASSERT(signum == SIGSEGV || signum == SIGBUS || MOZ_RELEASE_ASSERT(signum == SIGSEGV || signum == SIGBUS ||
signum == kWasmTrapSignal); signum == kWasmTrapSignal);
if (HandleTrap((CONTEXT*)context, TlsContext.get())) { if (HandleTrap((CONTEXT*)context, signum == SIGBUS, TlsContext.get())) {
return; return;
} }
} }

Просмотреть файл

@ -155,8 +155,8 @@ nsresult nsImageControlFrame::GetCursor(const nsPoint& aPoint,
// the cursor style is "auto" we use the pointer cursor. // the cursor style is "auto" we use the pointer cursor.
FillCursorInformationFromStyle(StyleUI(), aCursor); FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) { if (StyleCursorKind::Auto == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_POINTER; aCursor.mCursor = StyleCursorKind::Pointer;
} }
return NS_OK; return NS_OK;

Просмотреть файл

@ -5042,17 +5042,17 @@ void nsIFrame::AssociateImage(const nsStyleImage& aImage,
nsresult nsFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) { nsresult nsFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) {
FillCursorInformationFromStyle(StyleUI(), aCursor); FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) { if (StyleCursorKind::Auto == aCursor.mCursor) {
// If this is editable, I-beam cursor is better for most elements. // If this is editable, I-beam cursor is better for most elements.
aCursor.mCursor = (mContent && mContent->IsEditable()) aCursor.mCursor = (mContent && mContent->IsEditable())
? NS_STYLE_CURSOR_TEXT ? StyleCursorKind::Text
: NS_STYLE_CURSOR_DEFAULT; : StyleCursorKind::Default;
} }
if (NS_STYLE_CURSOR_TEXT == aCursor.mCursor && if (StyleCursorKind::Text == aCursor.mCursor &&
GetWritingMode().IsVertical()) { GetWritingMode().IsVertical()) {
// Per CSS UI spec, UA may treat value 'text' as // Per CSS UI spec, UA may treat value 'text' as
// 'vertical-text' for vertical text. // 'vertical-text' for vertical text.
aCursor.mCursor = NS_STYLE_CURSOR_VERTICAL_TEXT; aCursor.mCursor = StyleCursorKind::VerticalText;
} }
return NS_OK; return NS_OK;

Просмотреть файл

@ -632,10 +632,10 @@ nsresult nsHTMLFramesetFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor) { nsIFrame::Cursor& aCursor) {
aCursor.mLoading = false; aCursor.mLoading = false;
if (mDragger) { if (mDragger) {
aCursor.mCursor = (mDragger->mVertical) ? NS_STYLE_CURSOR_EW_RESIZE aCursor.mCursor = (mDragger->mVertical) ? StyleCursorKind::EwResize
: NS_STYLE_CURSOR_NS_RESIZE; : StyleCursorKind::NsResize;
} else { } else {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = StyleCursorKind::Default;
} }
return NS_OK; return NS_OK;
} }
@ -1468,10 +1468,10 @@ nsresult nsHTMLFramesetBorderFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor) { nsIFrame::Cursor& aCursor) {
aCursor.mLoading = false; aCursor.mLoading = false;
if (!mCanResize) { if (!mCanResize) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = StyleCursorKind::Default;
} else { } else {
aCursor.mCursor = aCursor.mCursor =
(mVertical) ? NS_STYLE_CURSOR_EW_RESIZE : NS_STYLE_CURSOR_NS_RESIZE; (mVertical) ? StyleCursorKind::EwResize: StyleCursorKind::NsResize;
} }
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -1986,7 +1986,7 @@ class nsIFrame : public nsQueryFrame {
*/ */
struct MOZ_STACK_CLASS Cursor { struct MOZ_STACK_CLASS Cursor {
nsCOMPtr<imgIContainer> mContainer; nsCOMPtr<imgIContainer> mContainer;
int32_t mCursor = NS_STYLE_CURSOR_AUTO; mozilla::StyleCursorKind mCursor = mozilla::StyleCursorKind::Auto;
bool mHaveHotspot = false; bool mHaveHotspot = false;
bool mLoading = false; bool mLoading = false;
float mHotspotX = 0.0f, mHotspotY = 0.0f; float mHotspotX = 0.0f, mHotspotY = 0.0f;

Просмотреть файл

@ -1618,8 +1618,7 @@ ImgDrawResult nsImageFrame::DisplayAltFeedbackWithoutLayer(
size); size);
const int32_t factor = PresContext()->AppUnitsPerDevPixel(); const int32_t factor = PresContext()->AppUnitsPerDevPixel();
LayoutDeviceRect destRect( LayoutDeviceRect destRect(LayoutDeviceRect::FromAppUnits(dest, factor));
LayoutDeviceRect::FromAppUnits(dest, factor));
destRect.Round(); destRect.Round();
Maybe<SVGImageContext> svgContext; Maybe<SVGImageContext> svgContext;
@ -2312,8 +2311,8 @@ nsresult nsImageFrame::GetCursor(const nsPoint& aPoint,
PresShell()->StyleSet()->ResolveStyleFor(area->AsElement(), PresShell()->StyleSet()->ResolveStyleFor(area->AsElement(),
LazyComputeBehavior::Allow); LazyComputeBehavior::Allow);
FillCursorInformationFromStyle(areaStyle->StyleUI(), aCursor); FillCursorInformationFromStyle(areaStyle->StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) { if (StyleCursorKind::Auto == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = StyleCursorKind::Default;
} }
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -4590,13 +4590,13 @@ nsTextFrame::~nsTextFrame() {}
nsresult nsTextFrame::GetCursor(const nsPoint& aPoint, nsresult nsTextFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor) { nsIFrame::Cursor& aCursor) {
FillCursorInformationFromStyle(StyleUI(), aCursor); FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) { if (StyleCursorKind::Auto == aCursor.mCursor) {
if (!IsSelectable(nullptr)) { if (!IsSelectable(nullptr)) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = StyleCursorKind::Default;
} else { } else {
aCursor.mCursor = GetWritingMode().IsVertical() aCursor.mCursor = GetWritingMode().IsVertical()
? NS_STYLE_CURSOR_VERTICAL_TEXT ? StyleCursorKind::VerticalText
: NS_STYLE_CURSOR_TEXT; : StyleCursorKind::Text;
} }
return NS_OK; return NS_OK;
} else { } else {

Просмотреть файл

@ -389,6 +389,7 @@ cbindgen-types = [
{ gecko = "StyleComputedFontStyleDescriptor", servo = "font_face::ComputedFontStyleDescriptor" }, { gecko = "StyleComputedFontStyleDescriptor", servo = "font_face::ComputedFontStyleDescriptor" },
{ gecko = "StyleComputedFontWeightRange", servo = "font_face::ComputedFontWeightRange" }, { gecko = "StyleComputedFontWeightRange", servo = "font_face::ComputedFontWeightRange" },
{ gecko = "StyleComputedTimingFunction", servo = "values::computed::easing::TimingFunction" }, { gecko = "StyleComputedTimingFunction", servo = "values::computed::easing::TimingFunction" },
{ gecko = "StyleCursorKind", servo = "values::computed::ui::CursorKind" },
{ gecko = "StyleDisplay", servo = "values::specified::Display" }, { gecko = "StyleDisplay", servo = "values::specified::Display" },
{ gecko = "StyleDisplayMode", servo = "gecko::media_features::DisplayMode" }, { gecko = "StyleDisplayMode", servo = "gecko::media_features::DisplayMode" },
{ gecko = "StyleExtremumLength", servo = "values::computed::length::ExtremumLength" }, { gecko = "StyleExtremumLength", servo = "values::computed::length::ExtremumLength" },

Просмотреть файл

@ -82,6 +82,7 @@ SERIALIZED_PREDEFINED_TYPES = [
"Content", "Content",
"CounterIncrement", "CounterIncrement",
"CounterReset", "CounterReset",
"Cursor",
"FillRule", "FillRule",
"Float", "Float",
"FontFamily", "FontFamily",

Просмотреть файл

@ -177,49 +177,49 @@ const KTableEntry nsCSSProps::kBoxShadowTypeKTable[] = {
const KTableEntry nsCSSProps::kCursorKTable[] = { const KTableEntry nsCSSProps::kCursorKTable[] = {
// CSS 2.0 // CSS 2.0
{eCSSKeyword_auto, NS_STYLE_CURSOR_AUTO}, {eCSSKeyword_auto, StyleCursorKind::Auto},
{eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR}, {eCSSKeyword_crosshair, StyleCursorKind::Crosshair},
{eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT}, {eCSSKeyword_default, StyleCursorKind::Default},
{eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER}, {eCSSKeyword_pointer, StyleCursorKind::Pointer},
{eCSSKeyword_move, NS_STYLE_CURSOR_MOVE}, {eCSSKeyword_move, StyleCursorKind::Move},
{eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE}, {eCSSKeyword_e_resize, StyleCursorKind::EResize},
{eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE}, {eCSSKeyword_ne_resize, StyleCursorKind::NeResize},
{eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE}, {eCSSKeyword_nw_resize, StyleCursorKind::NwResize},
{eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE}, {eCSSKeyword_n_resize, StyleCursorKind::NResize},
{eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE}, {eCSSKeyword_se_resize, StyleCursorKind::SeResize},
{eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE}, {eCSSKeyword_sw_resize, StyleCursorKind::SwResize},
{eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE}, {eCSSKeyword_s_resize, StyleCursorKind::SResize},
{eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE}, {eCSSKeyword_w_resize, StyleCursorKind::WResize},
{eCSSKeyword_text, NS_STYLE_CURSOR_TEXT}, {eCSSKeyword_text, StyleCursorKind::Text},
{eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT}, {eCSSKeyword_wait, StyleCursorKind::Wait},
{eCSSKeyword_help, NS_STYLE_CURSOR_HELP}, {eCSSKeyword_help, StyleCursorKind::Help},
// CSS 2.1 // CSS 2.1
{eCSSKeyword_progress, NS_STYLE_CURSOR_SPINNING}, {eCSSKeyword_progress, StyleCursorKind::Progress},
// CSS3 basic user interface module // CSS3 basic user interface module
{eCSSKeyword_copy, NS_STYLE_CURSOR_COPY}, {eCSSKeyword_copy, StyleCursorKind::Copy},
{eCSSKeyword_alias, NS_STYLE_CURSOR_ALIAS}, {eCSSKeyword_alias, StyleCursorKind::Alias},
{eCSSKeyword_context_menu, NS_STYLE_CURSOR_CONTEXT_MENU}, {eCSSKeyword_context_menu, StyleCursorKind::ContextMenu},
{eCSSKeyword_cell, NS_STYLE_CURSOR_CELL}, {eCSSKeyword_cell, StyleCursorKind::Cell},
{eCSSKeyword_not_allowed, NS_STYLE_CURSOR_NOT_ALLOWED}, {eCSSKeyword_not_allowed, StyleCursorKind::NotAllowed},
{eCSSKeyword_col_resize, NS_STYLE_CURSOR_COL_RESIZE}, {eCSSKeyword_col_resize, StyleCursorKind::ColResize},
{eCSSKeyword_row_resize, NS_STYLE_CURSOR_ROW_RESIZE}, {eCSSKeyword_row_resize, StyleCursorKind::RowResize},
{eCSSKeyword_no_drop, NS_STYLE_CURSOR_NO_DROP}, {eCSSKeyword_no_drop, StyleCursorKind::NoDrop},
{eCSSKeyword_vertical_text, NS_STYLE_CURSOR_VERTICAL_TEXT}, {eCSSKeyword_vertical_text, StyleCursorKind::VerticalText},
{eCSSKeyword_all_scroll, NS_STYLE_CURSOR_ALL_SCROLL}, {eCSSKeyword_all_scroll, StyleCursorKind::AllScroll},
{eCSSKeyword_nesw_resize, NS_STYLE_CURSOR_NESW_RESIZE}, {eCSSKeyword_nesw_resize, StyleCursorKind::NeswResize},
{eCSSKeyword_nwse_resize, NS_STYLE_CURSOR_NWSE_RESIZE}, {eCSSKeyword_nwse_resize, StyleCursorKind::NwseResize},
{eCSSKeyword_ns_resize, NS_STYLE_CURSOR_NS_RESIZE}, {eCSSKeyword_ns_resize, StyleCursorKind::NsResize},
{eCSSKeyword_ew_resize, NS_STYLE_CURSOR_EW_RESIZE}, {eCSSKeyword_ew_resize, StyleCursorKind::EwResize},
{eCSSKeyword_none, NS_STYLE_CURSOR_NONE}, {eCSSKeyword_none, StyleCursorKind::None},
{eCSSKeyword_grab, NS_STYLE_CURSOR_GRAB}, {eCSSKeyword_grab, StyleCursorKind::Grab},
{eCSSKeyword_grabbing, NS_STYLE_CURSOR_GRABBING}, {eCSSKeyword_grabbing, StyleCursorKind::Grabbing},
{eCSSKeyword_zoom_in, NS_STYLE_CURSOR_ZOOM_IN}, {eCSSKeyword_zoom_in, StyleCursorKind::ZoomIn},
{eCSSKeyword_zoom_out, NS_STYLE_CURSOR_ZOOM_OUT}, {eCSSKeyword_zoom_out, StyleCursorKind::ZoomOut},
// -moz- prefixed vendor specific // -moz- prefixed vendor specific
{eCSSKeyword__moz_grab, NS_STYLE_CURSOR_GRAB}, {eCSSKeyword__moz_grab, StyleCursorKind::Grab},
{eCSSKeyword__moz_grabbing, NS_STYLE_CURSOR_GRABBING}, {eCSSKeyword__moz_grabbing, StyleCursorKind::Grabbing},
{eCSSKeyword__moz_zoom_in, NS_STYLE_CURSOR_ZOOM_IN}, {eCSSKeyword__moz_zoom_in, StyleCursorKind::ZoomIn},
{eCSSKeyword__moz_zoom_out, NS_STYLE_CURSOR_ZOOM_OUT}, {eCSSKeyword__moz_zoom_out, StyleCursorKind::ZoomOut},
{eCSSKeyword_UNKNOWN, -1}}; {eCSSKeyword_UNKNOWN, -1}};
KTableEntry nsCSSProps::kDisplayKTable[] = { KTableEntry nsCSSProps::kDisplayKTable[] = {

Просмотреть файл

@ -2261,38 +2261,6 @@ already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetCaretColor() {
return val.forget(); return val.forget();
} }
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetCursor() {
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
const nsStyleUI* ui = StyleUI();
for (const nsCursorImage& item : ui->mCursorImages) {
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToURLValue(item.mImage->GetImageValue(), val);
itemList->AppendCSSValue(val.forget());
if (item.mHaveHotspot) {
RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
RefPtr<nsROCSSPrimitiveValue> valY = new nsROCSSPrimitiveValue;
valX->SetNumber(item.mHotspotX);
valY->SetNumber(item.mHotspotY);
itemList->AppendCSSValue(valX.forget());
itemList->AppendCSSValue(valY.forget());
}
valueList->AppendCSSValue(itemList.forget());
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(ui->mCursor, nsCSSProps::kCursorKTable));
valueList->AppendCSSValue(val.forget());
return valueList.forget();
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBoxFlex() { already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBoxFlex() {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue; RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetNumber(StyleXUL()->mBoxFlex); val->SetNumber(StyleXUL()->mBoxFlex);

Просмотреть файл

@ -344,7 +344,6 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
/* User interface properties */ /* User interface properties */
already_AddRefed<CSSValue> DoGetCaretColor(); already_AddRefed<CSSValue> DoGetCaretColor();
already_AddRefed<CSSValue> DoGetCursor();
already_AddRefed<CSSValue> DoGetForceBrokenImageIcon(); already_AddRefed<CSSValue> DoGetForceBrokenImageIcon();
/* Column properties */ /* Column properties */

Просмотреть файл

@ -297,44 +297,6 @@ enum class StyleContent : uint8_t {
AltContent AltContent
}; };
// See nsStyleUI
#define NS_STYLE_CURSOR_AUTO 1
#define NS_STYLE_CURSOR_CROSSHAIR 2
#define NS_STYLE_CURSOR_DEFAULT 3 // ie: an arrow
#define NS_STYLE_CURSOR_POINTER 4 // for links
#define NS_STYLE_CURSOR_MOVE 5
#define NS_STYLE_CURSOR_E_RESIZE 6
#define NS_STYLE_CURSOR_NE_RESIZE 7
#define NS_STYLE_CURSOR_NW_RESIZE 8
#define NS_STYLE_CURSOR_N_RESIZE 9
#define NS_STYLE_CURSOR_SE_RESIZE 10
#define NS_STYLE_CURSOR_SW_RESIZE 11
#define NS_STYLE_CURSOR_S_RESIZE 12
#define NS_STYLE_CURSOR_W_RESIZE 13
#define NS_STYLE_CURSOR_TEXT 14 // ie: i-beam
#define NS_STYLE_CURSOR_WAIT 15
#define NS_STYLE_CURSOR_HELP 16
#define NS_STYLE_CURSOR_COPY 17 // CSS3
#define NS_STYLE_CURSOR_ALIAS 18
#define NS_STYLE_CURSOR_CONTEXT_MENU 19
#define NS_STYLE_CURSOR_CELL 20
#define NS_STYLE_CURSOR_GRAB 21
#define NS_STYLE_CURSOR_GRABBING 22
#define NS_STYLE_CURSOR_SPINNING 23
#define NS_STYLE_CURSOR_ZOOM_IN 24
#define NS_STYLE_CURSOR_ZOOM_OUT 25
#define NS_STYLE_CURSOR_NOT_ALLOWED 26
#define NS_STYLE_CURSOR_COL_RESIZE 27
#define NS_STYLE_CURSOR_ROW_RESIZE 28
#define NS_STYLE_CURSOR_NO_DROP 29
#define NS_STYLE_CURSOR_VERTICAL_TEXT 30
#define NS_STYLE_CURSOR_ALL_SCROLL 31
#define NS_STYLE_CURSOR_NESW_RESIZE 32
#define NS_STYLE_CURSOR_NWSE_RESIZE 33
#define NS_STYLE_CURSOR_NS_RESIZE 34
#define NS_STYLE_CURSOR_EW_RESIZE 35
#define NS_STYLE_CURSOR_NONE 36
// See nsStyleVisibility // See nsStyleVisibility
#define NS_STYLE_DIRECTION_LTR 0 #define NS_STYLE_DIRECTION_LTR 0
#define NS_STYLE_DIRECTION_RTL 1 #define NS_STYLE_DIRECTION_RTL 1

Просмотреть файл

@ -3999,7 +3999,7 @@ nsStyleUI::nsStyleUI(const nsPresContext* aContext)
mUserModify(StyleUserModify::ReadOnly), mUserModify(StyleUserModify::ReadOnly),
mUserFocus(StyleUserFocus::None), mUserFocus(StyleUserFocus::None),
mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO), mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO),
mCursor(NS_STYLE_CURSOR_AUTO), mCursor(StyleCursorKind::Auto),
mCaretColor(StyleComplexColor::Auto()), mCaretColor(StyleComplexColor::Auto()),
mScrollbarFaceColor(StyleComplexColor::Auto()), mScrollbarFaceColor(StyleComplexColor::Auto()),
mScrollbarTrackColor(StyleComplexColor::Auto()) { mScrollbarTrackColor(StyleComplexColor::Auto()) {

Просмотреть файл

@ -2574,7 +2574,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI {
mozilla::StyleUserFocus mUserFocus; // (auto-select) mozilla::StyleUserFocus mUserFocus; // (auto-select)
uint8_t mPointerEvents; // NS_STYLE_POINTER_EVENTS_* uint8_t mPointerEvents; // NS_STYLE_POINTER_EVENTS_*
uint8_t mCursor; // NS_STYLE_CURSOR_* mozilla::StyleCursorKind mCursor;
nsTArray<nsCursorImage> mCursorImages; // images and coords nsTArray<nsCursorImage> mCursorImages; // images and coords
mozilla::StyleComplexColor mCaretColor; mozilla::StyleComplexColor mCaretColor;

Просмотреть файл

@ -2233,8 +2233,8 @@ nsresult nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
ComputedStyle* childContext = GetPseudoComputedStyle(child); ComputedStyle* childContext = GetPseudoComputedStyle(child);
FillCursorInformationFromStyle(childContext->StyleUI(), aCursor); FillCursorInformationFromStyle(childContext->StyleUI(), aCursor);
if (aCursor.mCursor == NS_STYLE_CURSOR_AUTO) if (aCursor.mCursor == StyleCursorKind::Auto)
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = StyleCursorKind::Default;
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -7499,20 +7499,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
mTransactionTimings.domainLookupEnd = mDNSPrefetch->EndTimestamp(); mTransactionTimings.domainLookupEnd = mDNSPrefetch->EndTimestamp();
} }
mDNSPrefetch = nullptr; mDNSPrefetch = nullptr;
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active() && !mRedirectURI) {
// Don't include this if we already redirected
// These do allocations/frees/etc; avoid if not active
nsCOMPtr<nsIURI> uri;
GetURI(getter_AddRefs(uri));
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
profiler_add_network_marker(
uri, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mLogicalOffset,
mCacheDisposition, &mTransactionTimings, nullptr);
}
#endif
// handle auth retry... // handle auth retry...
if (authRetry) { if (authRetry) {
@ -7743,6 +7729,21 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
// Register entry to the PerformanceStorage resource timing // Register entry to the PerformanceStorage resource timing
MaybeReportTimingData(); MaybeReportTimingData();
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active() && !mRedirectURI) {
// Don't include this if we already redirected
// These do allocations/frees/etc; avoid if not active
nsCOMPtr<nsIURI> uri;
GetURI(getter_AddRefs(uri));
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
profiler_add_network_marker(
uri, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mLogicalOffset,
mCacheDisposition, &mTransactionTimings, nullptr);
}
#endif
if (mListener) { if (mListener) {
LOG(("nsHttpChannel %p calling OnStopRequest\n", this)); LOG(("nsHttpChannel %p calling OnStopRequest\n", this));
MOZ_ASSERT(mOnStartRequestCalled, MOZ_ASSERT(mOnStartRequestCalled,

Просмотреть файл

@ -48,6 +48,7 @@ include = [
"ComputedFontStyleDescriptor", "ComputedFontStyleDescriptor",
"ComputedFontWeightRange", "ComputedFontWeightRange",
"ComputedTimingFunction", "ComputedTimingFunction",
"CursorKind",
"Display", "Display",
"DisplayMode", "DisplayMode",
"ExtremumLength", "ExtremumLength",

Просмотреть файл

@ -5162,52 +5162,7 @@ clip-path
<%self:impl_trait style_struct_name="InheritedUI" <%self:impl_trait style_struct_name="InheritedUI"
skip_longhands="cursor scrollbar-color"> skip_longhands="cursor scrollbar-color">
pub fn set_cursor(&mut self, v: longhands::cursor::computed_value::T) { pub fn set_cursor(&mut self, v: longhands::cursor::computed_value::T) {
use style_traits::cursor::CursorKind; self.gecko.mCursor = v.keyword;
self.gecko.mCursor = match v.keyword {
CursorKind::Auto => structs::NS_STYLE_CURSOR_AUTO,
CursorKind::None => structs::NS_STYLE_CURSOR_NONE,
CursorKind::Default => structs::NS_STYLE_CURSOR_DEFAULT,
CursorKind::Pointer => structs::NS_STYLE_CURSOR_POINTER,
CursorKind::ContextMenu => structs::NS_STYLE_CURSOR_CONTEXT_MENU,
CursorKind::Help => structs::NS_STYLE_CURSOR_HELP,
CursorKind::Progress => structs::NS_STYLE_CURSOR_SPINNING,
CursorKind::Wait => structs::NS_STYLE_CURSOR_WAIT,
CursorKind::Cell => structs::NS_STYLE_CURSOR_CELL,
CursorKind::Crosshair => structs::NS_STYLE_CURSOR_CROSSHAIR,
CursorKind::Text => structs::NS_STYLE_CURSOR_TEXT,
CursorKind::VerticalText => structs::NS_STYLE_CURSOR_VERTICAL_TEXT,
CursorKind::Alias => structs::NS_STYLE_CURSOR_ALIAS,
CursorKind::Copy => structs::NS_STYLE_CURSOR_COPY,
CursorKind::Move => structs::NS_STYLE_CURSOR_MOVE,
CursorKind::NoDrop => structs::NS_STYLE_CURSOR_NO_DROP,
CursorKind::NotAllowed => structs::NS_STYLE_CURSOR_NOT_ALLOWED,
CursorKind::Grab => structs::NS_STYLE_CURSOR_GRAB,
CursorKind::Grabbing => structs::NS_STYLE_CURSOR_GRABBING,
CursorKind::EResize => structs::NS_STYLE_CURSOR_E_RESIZE,
CursorKind::NResize => structs::NS_STYLE_CURSOR_N_RESIZE,
CursorKind::NeResize => structs::NS_STYLE_CURSOR_NE_RESIZE,
CursorKind::NwResize => structs::NS_STYLE_CURSOR_NW_RESIZE,
CursorKind::SResize => structs::NS_STYLE_CURSOR_S_RESIZE,
CursorKind::SeResize => structs::NS_STYLE_CURSOR_SE_RESIZE,
CursorKind::SwResize => structs::NS_STYLE_CURSOR_SW_RESIZE,
CursorKind::WResize => structs::NS_STYLE_CURSOR_W_RESIZE,
CursorKind::EwResize => structs::NS_STYLE_CURSOR_EW_RESIZE,
CursorKind::NsResize => structs::NS_STYLE_CURSOR_NS_RESIZE,
CursorKind::NeswResize => structs::NS_STYLE_CURSOR_NESW_RESIZE,
CursorKind::NwseResize => structs::NS_STYLE_CURSOR_NWSE_RESIZE,
CursorKind::ColResize => structs::NS_STYLE_CURSOR_COL_RESIZE,
CursorKind::RowResize => structs::NS_STYLE_CURSOR_ROW_RESIZE,
CursorKind::AllScroll => structs::NS_STYLE_CURSOR_ALL_SCROLL,
CursorKind::ZoomIn => structs::NS_STYLE_CURSOR_ZOOM_IN,
CursorKind::ZoomOut => structs::NS_STYLE_CURSOR_ZOOM_OUT,
// note: the following properties are gecko-only.
CursorKind::MozGrab => structs::NS_STYLE_CURSOR_GRAB,
CursorKind::MozGrabbing => structs::NS_STYLE_CURSOR_GRABBING,
CursorKind::MozZoomIn => structs::NS_STYLE_CURSOR_ZOOM_IN,
CursorKind::MozZoomOut => structs::NS_STYLE_CURSOR_ZOOM_OUT,
} as u8;
unsafe { unsafe {
Gecko_SetCursorArrayLength(&mut self.gecko, v.images.len()); Gecko_SetCursorArrayLength(&mut self.gecko, v.images.len());
} }
@ -5246,47 +5201,8 @@ clip-path
pub fn clone_cursor(&self) -> longhands::cursor::computed_value::T { pub fn clone_cursor(&self) -> longhands::cursor::computed_value::T {
use crate::values::computed::ui::CursorImage; use crate::values::computed::ui::CursorImage;
use crate::values::computed::url::ComputedImageUrl; use crate::values::computed::url::ComputedImageUrl;
use style_traits::cursor::CursorKind;
let keyword = match self.gecko.mCursor as u32 { let keyword = self.gecko.mCursor;
structs::NS_STYLE_CURSOR_AUTO => CursorKind::Auto,
structs::NS_STYLE_CURSOR_NONE => CursorKind::None,
structs::NS_STYLE_CURSOR_DEFAULT => CursorKind::Default,
structs::NS_STYLE_CURSOR_POINTER => CursorKind::Pointer,
structs::NS_STYLE_CURSOR_CONTEXT_MENU => CursorKind::ContextMenu,
structs::NS_STYLE_CURSOR_HELP => CursorKind::Help,
structs::NS_STYLE_CURSOR_SPINNING => CursorKind::Progress,
structs::NS_STYLE_CURSOR_WAIT => CursorKind::Wait,
structs::NS_STYLE_CURSOR_CELL => CursorKind::Cell,
structs::NS_STYLE_CURSOR_CROSSHAIR => CursorKind::Crosshair,
structs::NS_STYLE_CURSOR_TEXT => CursorKind::Text,
structs::NS_STYLE_CURSOR_VERTICAL_TEXT => CursorKind::VerticalText,
structs::NS_STYLE_CURSOR_ALIAS => CursorKind::Alias,
structs::NS_STYLE_CURSOR_COPY => CursorKind::Copy,
structs::NS_STYLE_CURSOR_MOVE => CursorKind::Move,
structs::NS_STYLE_CURSOR_NO_DROP => CursorKind::NoDrop,
structs::NS_STYLE_CURSOR_NOT_ALLOWED => CursorKind::NotAllowed,
structs::NS_STYLE_CURSOR_GRAB => CursorKind::Grab,
structs::NS_STYLE_CURSOR_GRABBING => CursorKind::Grabbing,
structs::NS_STYLE_CURSOR_E_RESIZE => CursorKind::EResize,
structs::NS_STYLE_CURSOR_N_RESIZE => CursorKind::NResize,
structs::NS_STYLE_CURSOR_NE_RESIZE => CursorKind::NeResize,
structs::NS_STYLE_CURSOR_NW_RESIZE => CursorKind::NwResize,
structs::NS_STYLE_CURSOR_S_RESIZE => CursorKind::SResize,
structs::NS_STYLE_CURSOR_SE_RESIZE => CursorKind::SeResize,
structs::NS_STYLE_CURSOR_SW_RESIZE => CursorKind::SwResize,
structs::NS_STYLE_CURSOR_W_RESIZE => CursorKind::WResize,
structs::NS_STYLE_CURSOR_EW_RESIZE => CursorKind::EwResize,
structs::NS_STYLE_CURSOR_NS_RESIZE => CursorKind::NsResize,
structs::NS_STYLE_CURSOR_NESW_RESIZE => CursorKind::NeswResize,
structs::NS_STYLE_CURSOR_NWSE_RESIZE => CursorKind::NwseResize,
structs::NS_STYLE_CURSOR_COL_RESIZE => CursorKind::ColResize,
structs::NS_STYLE_CURSOR_ROW_RESIZE => CursorKind::RowResize,
structs::NS_STYLE_CURSOR_ALL_SCROLL => CursorKind::AllScroll,
structs::NS_STYLE_CURSOR_ZOOM_IN => CursorKind::ZoomIn,
structs::NS_STYLE_CURSOR_ZOOM_OUT => CursorKind::ZoomOut,
_ => panic!("Found unexpected value in style struct for cursor property"),
};
let images = self.gecko.mCursorImages.iter().map(|gecko_cursor_image| { let images = self.gecko.mCursorImages.iter().map(|gecko_cursor_image| {
let url = unsafe { let url = unsafe {

Просмотреть файл

@ -28,7 +28,6 @@ use std::cell::RefCell;
use std::cmp; use std::cmp;
use std::f32; use std::f32;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::cursor::CursorKind;
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
@ -452,7 +451,6 @@ trivial_to_computed_value!(u8);
trivial_to_computed_value!(u16); trivial_to_computed_value!(u16);
trivial_to_computed_value!(u32); trivial_to_computed_value!(u32);
trivial_to_computed_value!(Atom); trivial_to_computed_value!(Atom);
trivial_to_computed_value!(CursorKind);
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
trivial_to_computed_value!(Prefix); trivial_to_computed_value!(Prefix);
trivial_to_computed_value!(String); trivial_to_computed_value!(String);

Просмотреть файл

@ -10,6 +10,7 @@ use crate::values::computed::Number;
use crate::values::generics::ui as generics; use crate::values::generics::ui as generics;
use crate::values::{Auto, Either}; use crate::values::{Auto, Either};
pub use crate::values::specified::ui::CursorKind;
pub use crate::values::specified::ui::{MozForceBrokenImageIcon, UserSelect}; pub use crate::values::specified::ui::{MozForceBrokenImageIcon, UserSelect};
/// auto | <color> /// auto | <color>

Просмотреть файл

@ -5,7 +5,7 @@
//! Generic values for UI properties. //! Generic values for UI properties.
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::cursor::CursorKind; use values::specified::ui::CursorKind;
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
/// A generic value for the `cursor` property. /// A generic value for the `cursor` property.

Просмотреть файл

@ -12,7 +12,6 @@ use crate::values::specified::Number;
use crate::values::{Auto, Either}; use crate::values::{Auto, Either};
use cssparser::Parser; use cssparser::Parser;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::cursor::CursorKind;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
/// auto | <color> /// auto | <color>
@ -40,23 +39,11 @@ impl Parse for Cursor {
} }
Ok(Self { Ok(Self {
images: images.into_boxed_slice(), images: images.into_boxed_slice(),
keyword: CursorKind::parse(context, input)?, keyword: CursorKind::parse(input)?,
}) })
} }
} }
impl Parse for CursorKind {
fn parse<'i, 't>(
_context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let location = input.current_source_location();
let ident = input.expect_ident()?;
CursorKind::from_css_keyword(&ident)
.map_err(|_| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
}
impl Parse for CursorImage { impl Parse for CursorImage {
fn parse<'i, 't>( fn parse<'i, 't>(
context: &ParserContext, context: &ParserContext,
@ -166,3 +153,63 @@ pub enum UserSelect {
/// Force selection of all children. /// Force selection of all children.
All, All,
} }
/// The keywords allowed in the Cursor property.
///
/// https://drafts.csswg.org/css-ui-4/#propdef-cursor
#[allow(missing_docs)]
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
)]
#[repr(u8)]
pub enum CursorKind {
None,
Default,
Pointer,
ContextMenu,
Help,
Progress,
Wait,
Cell,
Crosshair,
Text,
VerticalText,
Alias,
Copy,
Move,
NoDrop,
NotAllowed,
Grab,
Grabbing,
EResize,
NResize,
NeResize,
NwResize,
SResize,
SeResize,
SwResize,
WResize,
EwResize,
NsResize,
NeswResize,
NwseResize,
ColResize,
RowResize,
AllScroll,
ZoomIn,
ZoomOut,
Auto,
MozGrab,
MozGrabbing,
MozZoomIn,
MozZoomOut,
}

Просмотреть файл

@ -1,118 +0,0 @@
/* 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 https://mozilla.org/MPL/2.0/. */
//! A list of common mouse cursors per CSS3-UI § 8.1.1.
use super::{CssWriter, KeywordsCollectFn, SpecifiedValueInfo, ToCss};
macro_rules! define_cursor {
(
common properties = [
$( $c_css: expr => $c_variant: ident = $c_value: expr, )+
]
gecko properties = [
$( $g_css: expr => $g_variant: ident = $g_value: expr, )+
]
) => {
/// <https://drafts.csswg.org/css-ui/#cursor>
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[repr(u8)]
#[allow(missing_docs)]
pub enum CursorKind {
$( $c_variant = $c_value, )+
$( #[cfg(feature = "gecko")] $g_variant = $g_value, )+
}
impl CursorKind {
/// Given a CSS keyword, get the corresponding cursor enum.
pub fn from_css_keyword(keyword: &str) -> Result<Self, ()> {
match_ignore_ascii_case! { &keyword,
$( $c_css => Ok(CursorKind::$c_variant), )+
$( #[cfg(feature = "gecko")] $g_css => Ok(CursorKind::$g_variant), )+
_ => Err(())
}
}
/// From the C u8 value, get the corresponding Cursor enum.
pub fn from_u8(value: u8) -> Result<Self, ()> {
match value {
$( $c_value => Ok(CursorKind::$c_variant), )+
$( #[cfg(feature = "gecko")] $g_value => Ok(CursorKind::$g_variant), )+
_ => Err(())
}
}
}
impl ToCss for CursorKind {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> ::std::fmt::Result where W: ::std::fmt::Write {
match *self {
$(CursorKind::$c_variant => {
::std::fmt::Write::write_str(dest, $c_css)
})+
$(#[cfg(feature = "gecko")] CursorKind::$g_variant => {
::std::fmt::Write::write_str(dest, $g_css)
})+
}
}
}
impl SpecifiedValueInfo for CursorKind {
fn collect_completion_keywords(f: KeywordsCollectFn) {
f(&[
$($c_css,)+
$($g_css,)+
]);
}
}
}
}
define_cursor! {
common properties = [
"none" => None = 0,
"default" => Default = 1,
"pointer" => Pointer = 2,
"context-menu" => ContextMenu = 3,
"help" => Help = 4,
"progress" => Progress = 5,
"wait" => Wait = 6,
"cell" => Cell = 7,
"crosshair" => Crosshair = 8,
"text" => Text = 9,
"vertical-text" => VerticalText = 10,
"alias" => Alias = 11,
"copy" => Copy = 12,
"move" => Move = 13,
"no-drop" => NoDrop = 14,
"not-allowed" => NotAllowed = 15,
"grab" => Grab = 16,
"grabbing" => Grabbing = 17,
"e-resize" => EResize = 18,
"n-resize" => NResize = 19,
"ne-resize" => NeResize = 20,
"nw-resize" => NwResize = 21,
"s-resize" => SResize = 22,
"se-resize" => SeResize = 23,
"sw-resize" => SwResize = 24,
"w-resize" => WResize = 25,
"ew-resize" => EwResize = 26,
"ns-resize" => NsResize = 27,
"nesw-resize" => NeswResize = 28,
"nwse-resize" => NwseResize = 29,
"col-resize" => ColResize = 30,
"row-resize" => RowResize = 31,
"all-scroll" => AllScroll = 32,
"zoom-in" => ZoomIn = 33,
"zoom-out" => ZoomOut = 34,
"auto" => Auto = 35,
]
// gecko only properties
gecko properties = [
"-moz-grab" => MozGrab = 36,
"-moz-grabbing" => MozGrabbing = 37,
"-moz-zoom-in" => MozZoomIn = 38,
"-moz-zoom-out" => MozZoomOut = 39,
]
}

Просмотреть файл

@ -81,7 +81,6 @@ pub enum CSSPixel {}
// / hidpi_ratio => DeviceIndependentPixel // / hidpi_ratio => DeviceIndependentPixel
// / desktop_zoom => CSSPixel // / desktop_zoom => CSSPixel
pub mod cursor;
pub mod specified_value_info; pub mod specified_value_info;
#[macro_use] #[macro_use]
pub mod values; pub mod values;