Changeset 23471 in webkit
- Timestamp:
- Jun 12, 2007 7:40:00 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r23469 r23471 1 2007-06-12 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Oliver. 4 5 Patch for http://bugs.webkit.org/show_bug.cgi?id=14109 6 Cleanup JSEvent and JSClipboard in preperation for autogeneration 7 8 * bindings/js/kjs_events.cpp: 9 (KJS::DOMEvent::DOMEvent): 10 (KJS::DOMEvent::getValueProperty): 11 (KJS::DOMEvent::put): 12 (KJS::DOMEvent::putValueProperty): 13 (KJS::DOMEventPrototypeFunction::callAsFunction): 14 (KJS::toJS): 15 (KJS::toEvent): 16 (KJS::): 17 (KJS::JSClipboard::JSClipboard): 18 (KJS::JSClipboard::~JSClipboard): 19 (KJS::JSClipboard::getOwnPropertySlot): 20 (KJS::JSClipboard::getValueProperty): 21 (KJS::JSClipboard::put): 22 (KJS::JSClipboard::putValueProperty): 23 (KJS::JSClipboardPrototypeFunction::callAsFunction): 24 (KJS::toClipboard): 25 * bindings/js/kjs_events.h: 26 (KJS::DOMEvent::): 27 (KJS::DOMEvent::impl): 28 (KJS::JSClipboard::impl): 29 * dom/ClipboardEvent.h: 30 * dom/Event.h: 31 (WebCore::Event::srcElement): 32 (WebCore::Event::returnValue): 33 (WebCore::Event::clipboardData): 34 (WebCore::Event::dataTransfer): 35 (WebCore::Event::clipboard): 36 * dom/MouseEvent.h: 37 1 38 2007-06-13 Lars Knoll <lars@trolltech.com> 2 39 -
trunk/WebCore/bindings/js/kjs_events.cpp
r22039 r23471 388 388 KJS_IMPLEMENT_PROTOTYPE("DOMEvent", DOMEventPrototype, DOMEventPrototypeFunction) 389 389 390 DOMEvent::DOMEvent(ExecState *exec, Event *e)391 : m_impl(e), clipboard(0)390 DOMEvent::DOMEvent(ExecState* exec, Event* event) 391 : m_impl(event) 392 392 { 393 393 setPrototype(DOMEventPrototype::self(exec)); … … 399 399 } 400 400 401 // pass marks through to JS objects we hold during garbage collection402 void DOMEvent::mark()403 {404 DOMObject::mark();405 if (clipboard && !clipboard->marked())406 clipboard->mark();407 }408 409 401 bool DOMEvent::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 410 402 { … … 412 404 } 413 405 414 JSValue *DOMEvent::getValueProperty(ExecState *exec, int token) const 415 { 416 Event &event = *m_impl; 417 switch (token) { 418 case Type: 419 return jsString(event.type()); 420 case Target: 421 case SrcElement: /*MSIE extension - "the object that fired the event"*/ 422 return toJS(exec, event.target()); 423 case CurrentTarget: 424 return toJS(exec, event.currentTarget()); 425 case EventPhase: 426 return jsNumber(event.eventPhase()); 427 case Bubbles: 428 return jsBoolean(event.bubbles()); 429 case CancelBubble: 430 return jsBoolean(event.cancelBubble()); 431 case ReturnValue: 432 return jsBoolean(!event.defaultPrevented()); 433 case Cancelable: 434 return jsBoolean(event.cancelable()); 435 case TimeStamp: 436 return jsNumber(event.timeStamp()); 437 case ClipboardData: 438 { 439 if (event.isClipboardEvent()) { 440 ClipboardEvent *impl = static_cast<ClipboardEvent *>(&event); 441 if (!clipboard) 442 clipboard = new Clipboard(exec, impl->clipboard()); 443 return clipboard; 444 } else 445 return jsUndefined(); 446 } 447 case DataTransfer: 448 { 449 if (event.isDragEvent()) { 450 MouseEvent *impl = static_cast<MouseEvent *>(&event); 451 if (!clipboard) 452 clipboard = new Clipboard(exec, impl->clipboard()); 453 return clipboard; 454 } else 455 return jsUndefined(); 456 } 457 default: 458 return 0; 459 } 460 } 461 462 void DOMEvent::put(ExecState *exec, const Identifier &propertyName, 463 JSValue *value, int attr) 406 JSValue* DOMEvent::getValueProperty(ExecState* exec, int token) const 407 { 408 Event* event = impl(); 409 switch (token) { 410 case Type: 411 return jsString(event->type()); 412 case Target: 413 return toJS(exec, event->target()); 414 case SrcElement: 415 return toJS(exec, event->srcElement()); 416 case CurrentTarget: 417 return toJS(exec, event->currentTarget()); 418 case EventPhase: 419 return jsNumber(event->eventPhase()); 420 case Bubbles: 421 return jsBoolean(event->bubbles()); 422 case CancelBubble: 423 return jsBoolean(event->cancelBubble()); 424 case ReturnValue: 425 return jsBoolean(event->returnValue()); 426 case Cancelable: 427 return jsBoolean(event->cancelable()); 428 case TimeStamp: 429 return jsNumber(event->timeStamp()); 430 case ClipboardData: 431 if (event->isClipboardEvent()) 432 return toJS(exec, event->clipboardData()); 433 return jsUndefined(); 434 case DataTransfer: 435 if (event->isDragEvent()) 436 return toJS(exec, event->dataTransfer()); 437 return jsUndefined(); 438 default: 439 return 0; 440 } 441 } 442 443 void DOMEvent::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) 464 444 { 465 445 lookupPut<DOMEvent, DOMObject>(exec, propertyName, value, attr, &DOMEventTable, this); 466 446 } 467 447 468 void DOMEvent::putValueProperty(ExecState *exec, int token, JSValue *value, int) 469 { 470 Event &event = *m_impl; 471 switch (token) { 472 case ReturnValue: 473 event.setDefaultPrevented(!value->toBoolean(exec)); 474 break; 475 case CancelBubble: 476 event.setCancelBubble(value->toBoolean(exec)); 477 break; 478 default: 479 break; 480 } 481 } 482 483 JSValue *DOMEventPrototypeFunction::callAsFunction(ExecState *exec, JSObject * thisObj, const List &args) 484 { 485 if (!thisObj->inherits(&DOMEvent::info)) 486 return throwError(exec, TypeError); 487 Event &event = *static_cast<DOMEvent *>( thisObj )->impl(); 488 switch (id) { 489 case DOMEvent::StopPropagation: 490 event.stopPropagation(); 491 return jsUndefined(); 492 case DOMEvent::PreventDefault: 493 event.preventDefault(); 494 return jsUndefined(); 495 case DOMEvent::InitEvent: 496 event.initEvent(AtomicString(args[0]->toString(exec)), args[1]->toBoolean(exec), args[2]->toBoolean(exec)); 497 return jsUndefined(); 448 void DOMEvent::putValueProperty(ExecState* exec, int token, JSValue* value, int) 449 { 450 Event* event = m_impl.get(); 451 switch (token) { 452 case ReturnValue: 453 event->setDefaultPrevented(!value->toBoolean(exec)); 454 break; 455 case CancelBubble: 456 event->setCancelBubble(value->toBoolean(exec)); 457 break; 458 default: 459 break; 460 } 461 } 462 463 JSValue* DOMEventPrototypeFunction::callAsFunction(ExecState *exec, JSObject * thisObj, const List &args) 464 { 465 if (!thisObj->inherits(&DOMEvent::info)) 466 return throwError(exec, TypeError); 467 468 Event* event = static_cast<DOMEvent*>(thisObj)->impl(); 469 switch (id) { 470 case DOMEvent::StopPropagation: 471 event->stopPropagation(); 472 return jsUndefined(); 473 case DOMEvent::PreventDefault: 474 event->preventDefault(); 475 return jsUndefined(); 476 case DOMEvent::InitEvent: 477 event->initEvent(AtomicString(args[0]->toString(exec)), args[1]->toBoolean(exec), args[2]->toBoolean(exec)); 478 return jsUndefined(); 498 479 }; 499 480 return jsUndefined(); 500 481 } 501 482 502 JSValue* toJS(ExecState* exec, Event* e) 503 { 504 if (!e) 505 return jsNull(); 506 507 ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter()); 508 509 JSLock lock; 510 511 DOMObject* ret = interp->getDOMObject(e); 512 if (!ret) { 513 if (e->isKeyboardEvent()) 514 ret = new JSKeyboardEvent(exec, static_cast<KeyboardEvent*>(e)); 515 else if (e->isTextEvent()) 516 ret = new JSTextEvent(exec, static_cast<TextEvent*>(e)); 517 else if (e->isMouseEvent()) 518 ret = new JSMouseEvent(exec, static_cast<MouseEvent*>(e)); 519 else if (e->isWheelEvent()) 520 ret = new JSWheelEvent(exec, static_cast<WheelEvent*>(e)); 521 else if (e->isUIEvent()) 522 ret = new JSUIEvent(exec, static_cast<UIEvent*>(e)); 523 else if (e->isMutationEvent()) 524 ret = new JSMutationEvent(exec, static_cast<MutationEvent*>(e)); 525 else if (e->isOverflowEvent()) 526 ret = new JSOverflowEvent(exec, static_cast<OverflowEvent*>(e)); 483 JSValue* toJS(ExecState* exec, Event* event) 484 { 485 if (!event) 486 return jsNull(); 487 488 ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter()); 489 490 JSLock lock; 491 492 DOMObject* ret = interp->getDOMObject(event); 493 if (ret) 494 return ret; 495 496 if (event->isKeyboardEvent()) 497 ret = new JSKeyboardEvent(exec, static_cast<KeyboardEvent*>(event)); 498 else if (event->isTextEvent()) 499 ret = new JSTextEvent(exec, static_cast<TextEvent*>(event)); 500 else if (event->isMouseEvent()) 501 ret = new JSMouseEvent(exec, static_cast<MouseEvent*>(event)); 502 else if (event->isWheelEvent()) 503 ret = new JSWheelEvent(exec, static_cast<WheelEvent*>(event)); 504 else if (event->isUIEvent()) 505 ret = new JSUIEvent(exec, static_cast<UIEvent*>(event)); 506 else if (event->isMutationEvent()) 507 ret = new JSMutationEvent(exec, static_cast<MutationEvent*>(event)); 508 else if (event->isOverflowEvent()) 509 ret = new JSOverflowEvent(exec, static_cast<OverflowEvent*>(event)); 527 510 else 528 ret = new JSEvent(exec, e); 529 530 interp->putDOMObject(e, ret); 531 } 532 533 return ret; 534 } 535 536 Event *toEvent(JSValue *val) 511 ret = new JSEvent(exec, event); 512 513 interp->putDOMObject(event, ret); 514 return ret; 515 } 516 517 Event* toEvent(JSValue* val) 537 518 { 538 519 if (!val || !val->isObject(&DOMEvent::info)) 539 520 return 0; 540 return static_cast<DOMEvent 521 return static_cast<DOMEvent*>(val)->impl(); 541 522 } 542 523 543 524 // ------------------------------------------------------------------------- 544 525 545 const ClassInfo Clipboard::info = { "Clipboard", 0, &ClipboardTable, 0 };546 547 /* Source for ClipboardTable. Use "make hashtables" to regenerate.548 @begin ClipboardTable 3549 dropEffect Clipboard::DropEffect DontDelete550 effectAllowed Clipboard::EffectAllowed DontDelete551 types Clipboard::Types DontDelete|ReadOnly526 const ClassInfo JSClipboard::info = { "Clipboard", 0, &JSClipboardTable, 0 }; 527 528 /* Source for JSClipboardTable. Use "make hashtables" to regenerate. 529 @begin JSClipboardTable 3 530 dropEffect JSClipboard::DropEffect DontDelete 531 effectAllowed JSClipboard::EffectAllowed DontDelete 532 types JSClipboard::Types DontDelete|ReadOnly 552 533 @end 553 @begin ClipboardPrototypeTable 4554 clearData Clipboard::ClearData DontDelete|Function 0555 getData Clipboard::GetData DontDelete|Function 1556 setData Clipboard::SetData DontDelete|Function 2557 setDragImage Clipboard::SetDragImage DontDelete|Function 3534 @begin JSClipboardPrototypeTable 4 535 clearData JSClipboard::ClearData DontDelete|Function 0 536 getData JSClipboard::GetData DontDelete|Function 1 537 setData JSClipboard::SetData DontDelete|Function 2 538 setDragImage JSClipboard::SetDragImage DontDelete|Function 3 558 539 @end 559 540 */ 560 541 561 KJS_DEFINE_PROTOTYPE(ClipboardPrototype) 562 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(ClipboardPrototypeFunction) 563 KJS_IMPLEMENT_PROTOTYPE("Clipboard", ClipboardPrototype, ClipboardPrototypeFunction) 564 565 Clipboard::Clipboard(ExecState *exec, WebCore::Clipboard *cb) 566 : clipboard(cb) 567 { 568 setPrototype(ClipboardPrototype::self(exec)); 569 } 570 571 bool Clipboard::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 572 { 573 return getStaticValueSlot<Clipboard, DOMObject>(exec, &ClipboardTable, this, propertyName, slot); 574 } 575 576 JSValue *Clipboard::getValueProperty(ExecState *exec, int token) const 577 { 542 KJS_DEFINE_PROTOTYPE(JSClipboardPrototype) 543 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(JSClipboardPrototypeFunction) 544 KJS_IMPLEMENT_PROTOTYPE("Clipboard", JSClipboardPrototype, JSClipboardPrototypeFunction) 545 546 JSClipboard::JSClipboard(ExecState* exec, WebCore::Clipboard* cb) 547 : m_impl(cb) 548 { 549 setPrototype(JSClipboardPrototype::self(exec)); 550 } 551 552 JSClipboard::~JSClipboard() 553 { 554 ScriptInterpreter::forgetDOMObject(m_impl.get()); 555 } 556 557 bool JSClipboard::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 558 { 559 return getStaticValueSlot<JSClipboard, DOMObject>(exec, &JSClipboardTable, this, propertyName, slot); 560 } 561 562 JSValue* JSClipboard::getValueProperty(ExecState* exec, int token) const 563 { 564 WebCore::Clipboard* clipboard = impl(); 578 565 switch (token) { 579 566 case DropEffect: … … 587 574 HashSet<String> types = clipboard->types(); 588 575 if (types.isEmpty()) 589 return jsNull(); 576 return jsNull(); 590 577 else { 591 578 List list; 592 579 HashSet<String>::const_iterator end = types.end(); 593 for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it) 580 for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it) 594 581 list.append(jsString(UString(*it))); 595 582 return exec->lexicalInterpreter()->builtinArray()->construct(exec, list); … … 597 584 } 598 585 default: 599 return NULL; 600 } 601 } 602 603 void Clipboard::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr) 604 { 605 lookupPut<Clipboard,DOMObject>(exec, propertyName, value, attr, &ClipboardTable, this ); 606 } 607 608 void Clipboard::putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/) 609 { 586 return 0; 587 } 588 } 589 590 void JSClipboard::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) 591 { 592 lookupPut<JSClipboard, DOMObject>(exec, propertyName, value, attr, &JSClipboardTable, this ); 593 } 594 595 void JSClipboard::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) 596 { 597 WebCore::Clipboard* clipboard = impl(); 610 598 switch (token) { 611 599 case DropEffect: … … 622 610 } 623 611 624 JSValue *ClipboardPrototypeFunction::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)625 { 626 if (!thisObj->inherits(& Clipboard::info))612 JSValue* JSClipboardPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) 613 { 614 if (!thisObj->inherits(&JSClipboard::info)) 627 615 return throwError(exec, TypeError); 628 616 629 Clipboard *cb = static_cast<Clipboard *>(thisObj);617 WebCore::Clipboard* clipboard = static_cast<JSClipboard*>(thisObj)->impl(); 630 618 switch (id) { 631 case Clipboard::ClearData:619 case JSClipboard::ClearData: 632 620 if (args.size() == 0) { 633 c b->clipboard->clearAllData();621 clipboard->clearAllData(); 634 622 return jsUndefined(); 635 623 } else if (args.size() == 1) { 636 c b->clipboard->clearData(args[0]->toString(exec));624 clipboard->clearData(args[0]->toString(exec)); 637 625 return jsUndefined(); 638 626 } else 639 627 return throwError(exec, SyntaxError, "clearData: Invalid number of arguments"); 640 case Clipboard::GetData:628 case JSClipboard::GetData: 641 629 { 642 630 if (args.size() == 1) { 643 631 bool success; 644 String result = c b->clipboard->getData(args[0]->toString(exec), success);632 String result = clipboard->getData(args[0]->toString(exec), success); 645 633 if (success) 646 634 return jsString(result); 647 else 648 return jsUndefined(); 635 return jsUndefined(); 649 636 } else 650 637 return throwError(exec, SyntaxError, "getData: Invalid number of arguments"); 651 638 } 652 case Clipboard::SetData:639 case JSClipboard::SetData: 653 640 if (args.size() == 2) 654 return jsBoolean(cb->clipboard->setData(args[0]->toString(exec), args[1]->toString(exec))); 655 else 656 return throwError(exec, SyntaxError, "setData: Invalid number of arguments"); 657 case Clipboard::SetDragImage: 641 return jsBoolean(clipboard->setData(args[0]->toString(exec), args[1]->toString(exec))); 642 return throwError(exec, SyntaxError, "setData: Invalid number of arguments"); 643 case JSClipboard::SetDragImage: 658 644 { 659 if (!c b->clipboard->isForDragging())645 if (!clipboard->isForDragging()) 660 646 return jsUndefined(); 661 647 … … 663 649 return throwError(exec, SyntaxError, "setDragImage: Invalid number of arguments"); 664 650 665 int x = (int)args[1]->toNumber(exec);666 int y = (int)args[2]->toNumber(exec);651 int x = static_cast<int>(args[1]->toNumber(exec)); 652 int y = static_cast<int>(args[2]->toNumber(exec)); 667 653 668 654 // See if they passed us a node 669 Node *node = toNode(args[0]);655 Node* node = toNode(args[0]); 670 656 if (!node) 671 657 return throwError(exec, TypeError); … … 676 662 if (static_cast<Element*>(node)->hasLocalName(imgTag) && 677 663 !node->inDocument()) 678 c b->clipboard->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(), IntPoint(x, y));664 clipboard->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(), IntPoint(x, y)); 679 665 else 680 c b->clipboard->setDragImageElement(node, IntPoint(x, y));666 clipboard->setDragImageElement(node, IntPoint(x, y)); 681 667 682 668 return jsUndefined(); … … 686 672 } 687 673 688 } 674 JSValue* toJS(ExecState* exec, WebCore::Clipboard* obj) 675 { 676 return cacheDOMObject<WebCore::Clipboard, JSClipboard>(exec, obj); 677 } 678 679 WebCore::Clipboard* toClipboard(JSValue* val) 680 { 681 return val->isObject(&JSClipboard::info) ? static_cast<JSClipboard*>(val)->impl() : 0; 682 } 683 684 } -
trunk/WebCore/bindings/js/kjs_events.h
r18912 r23471 39 39 40 40 class Window; 41 class Clipboard;41 class JSClipboard; 42 42 43 43 class JSAbstractEventListener : public WebCore::EventListener { … … 99 99 DOMEvent(ExecState*, WebCore::Event*); 100 100 virtual ~DOMEvent(); 101 101 102 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 102 103 JSValue* getValueProperty(ExecState*, int token) const; 103 104 virtual void put(ExecState*, const Identifier&, JSValue*, int attr = None); 104 void putValueProperty(ExecState*, int token, JSValue*, int); 105 void putValueProperty(ExecState*, int token, JSValue*, int attr); 106 105 107 virtual const ClassInfo* classInfo() const { return &info; } 106 108 static const ClassInfo info; 107 enum { Type, Target, CurrentTarget, EventPhase, Bubbles, 108 Cancelable, TimeStamp, StopPropagation, PreventDefault, InitEvent, 109 // MS IE equivalents 110 SrcElement, ReturnValue, CancelBubble, ClipboardData, DataTransfer }; 111 WebCore::Event *impl() const { return m_impl.get(); } 112 virtual void mark(); 109 110 enum { 111 Type, Target, CurrentTarget, EventPhase, 112 Bubbles, Cancelable, TimeStamp, StopPropagation, 113 PreventDefault, InitEvent, 114 115 // MS IE equivalents 116 SrcElement, ReturnValue, CancelBubble, ClipboardData, 117 DataTransfer 118 }; 119 120 WebCore::Event* impl() const { return m_impl.get(); } 121 113 122 protected: 114 123 RefPtr<WebCore::Event> m_impl; 115 mutable Clipboard* clipboard;116 124 }; 117 125 118 126 JSValue* toJS(ExecState*, WebCore::Event*); 119 120 127 WebCore::Event* toEvent(JSValue*); // returns 0 if value is not a DOMEvent object 121 128 122 129 KJS_DEFINE_PROTOTYPE(DOMEventPrototype) 123 130 124 class Clipboard : public DOMObject {125 friend classClipboardPrototypeFunction;131 class JSClipboard : public DOMObject { 132 friend class JSClipboardPrototypeFunction; 126 133 public: 127 Clipboard(ExecState*, WebCore::Clipboard *ds); 134 JSClipboard(ExecState*, WebCore::Clipboard* ds); 135 virtual ~JSClipboard(); 136 128 137 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 129 138 JSValue* getValueProperty(ExecState*, int token) const; 130 139 virtual void put(ExecState*, const Identifier&, JSValue*, int attr = None); 131 140 void putValueProperty(ExecState*, int token, JSValue*, int attr); 132 virtual bool toBoolean(ExecState*) const { return true; } 141 133 142 virtual const ClassInfo* classInfo() const { return &info; } 134 143 static const ClassInfo info; 144 135 145 enum { ClearData, GetData, SetData, Types, SetDragImage, DropEffect, EffectAllowed }; 146 147 WebCore::Clipboard* impl() const { return m_impl.get(); } 148 136 149 private: 137 RefPtr<WebCore::Clipboard> clipboard;150 RefPtr<WebCore::Clipboard> m_impl; 138 151 }; 152 153 JSValue* toJS(ExecState*, WebCore::Clipboard*); 154 WebCore::Clipboard* toClipboard(JSValue*); 139 155 140 156 } // namespace -
trunk/WebCore/dom/ClipboardEvent.h
r14916 r23471 5 5 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 6 6 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 7 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.7 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 8 8 * 9 9 * This library is free software; you can redistribute it and/or … … 38 38 39 39 Clipboard* clipboard() const { return m_clipboard.get(); } 40 40 41 virtual bool isClipboardEvent() const; 42 41 43 private: 42 44 RefPtr<Clipboard> m_clipboard; -
trunk/WebCore/dom/Event.h
r19855 r23471 5 5 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 6 6 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 7 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.7 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 8 8 * 9 9 * This library is free software; you can redistribute it and/or … … 32 32 33 33 namespace WebCore { 34 35 class Clipboard; 34 36 35 37 // FIXME: this should probably defined elsewhere. … … 90 92 void stopPropagation() { m_propagationStopped = true; } 91 93 94 // IE Extensions 95 EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event" 96 bool returnValue() const { return !m_defaultPrevented; } 97 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; } 98 Clipboard* dataTransfer() const { return isMouseEvent() ? clipboard() : 0; } 99 92 100 virtual bool isUIEvent() const; 93 101 virtual bool isMouseEvent() const; … … 122 130 virtual void storeResult(const String&); 123 131 132 virtual Clipboard* clipboard() const { return 0; } 133 124 134 protected: 125 135 virtual void receivedTarget(); -
trunk/WebCore/dom/MouseEvent.h
r20780 r23471 53 53 bool buttonDown() const { return m_buttonDown; } 54 54 EventTargetNode* relatedTarget() const { return m_relatedTarget.get(); } 55 55 56 Clipboard* clipboard() const { return m_clipboard.get(); } 56 57 57 58 Node* toElement() const; 58 59 Node* fromElement() const;
Note: See TracChangeset
for help on using the changeset viewer.