⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 212819 in webkit


Ignore:
Timestamp:
Feb 22, 2017, 1:50:42 AM (10 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r212773. rdar://problem/30640217

Location:
branches/safari-603.1.30.0-branch/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-603.1.30.0-branch/Source/WebCore/ChangeLog

    r212740 r212819  
     12017-02-22  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r212773. rdar://problem/30640217
     4
     5    2017-02-21  Chris Dumez  <cdumez@apple.com>
     6
     7            REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work
     8            https://bugs.webkit.org/show_bug.cgi?id=168677
     9            <rdar://problem/30640101>
     10
     11            Reviewed by Ryosuke Niwa.
     12
     13            Add quirk to initMouseEvent to unbreak iAd Producer.
     14
     15            * dom/MouseEvent.cpp:
     16            (WebCore::MouseEvent::initMouseEventQuirk):
     17            * dom/MouseEvent.h:
     18            * dom/MouseEvent.idl:
     19            * platform/RuntimeApplicationChecks.h:
     20            * platform/RuntimeApplicationChecks.mm:
     21            (WebCore::MacApplication::isIADProducer):
     22
    1232017-02-21  Matthew Hanson  <matthew_hanson@apple.com>
    224
  • branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.cpp

    r209895 r212819  
    2929#include "FrameView.h"
    3030#include "HTMLIFrameElement.h"
     31#include "JSDOMConvert.h"
     32#include "JSEventTarget.h"
     33#include "JSEventTargetCustom.h"
    3134#include "PlatformMouseEvent.h"
     35#include "RuntimeApplicationChecks.h"
    3236#include <wtf/CurrentTime.h>
    3337
    3438namespace WebCore {
     39
     40using namespace JSC;
    3541
    3642Ref<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer, IsTrusted isTrusted)
    … …  
    169175    // FIXME: m_isSimulated is not set to false here.
    170176    // FIXME: m_dataTransfer is not set to 0 here.
     177}
     178
     179// FIXME: We need this quirk because iAd Producer is calling this function with a relatedTarget that is not an EventTarget (rdar://problem/30640101).
     180// We should remove this quirk when possible.
     181void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue)
     182{
     183    EventTarget* relatedTarget = nullptr;
     184#if PLATFORM(MAC)
     185    if (MacApplication::isIAdProducer()) {
     186        // jsEventTargetCast() does not throw and will silently convert bad input to nullptr.
     187        auto jsRelatedTarget = jsEventTargetCast(relatedTargetValue);
     188        if (!jsRelatedTarget && !relatedTargetValue.isUndefinedOrNull())
     189            scriptExecutionContext.addConsoleMessage(MessageSource::JS, MessageLevel::Warning, ASCIILiteral("Calling initMouseEvent() with a relatedTarget that is not an EventTarget is deprecated."));
     190        relatedTarget = jsRelatedTarget ? &jsRelatedTarget->wrapped() : nullptr;
     191    } else {
     192#else
     193    UNUSED_PARAM(scriptExecutionContext);
     194#endif
     195        // This is what the bindings generator would have produced.
     196        auto throwScope = DECLARE_THROW_SCOPE(state.vm());
     197        relatedTarget = convert<IDLNullable<IDLInterface<EventTarget>>>(state, relatedTargetValue, [](ExecState& state, ThrowScope& scope) {
     198            throwArgumentTypeError(state, scope, 14, "relatedTarget", "MouseEvent", "initMouseEvent", "EventTarget");
     199        });
     200        RETURN_IF_EXCEPTION(throwScope, void());
     201#if PLATFORM(MAC)
     202    }
     203#endif
     204    initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
    171205}
    172206
  • branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.h

    r207041 r212819  
    7070        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
    7171        unsigned short button, PassRefPtr<EventTarget> relatedTarget);
    72 
     72    void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget);
    7373    // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
    7474    // but we will match the standard DOM.
  • branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.idl

    r207041 r212819  
    4040
    4141    // FIXME: Using "undefined" as default parameter value is wrong.
    42     void initMouseEvent(optional DOMString type = "undefined", optional boolean canBubble = false,  optional boolean cancelable = false,
     42    // FIXME: relatedTarget should be of type EventTarget? but we need to use any to support a quirk for iAd Producer (rdar://problem/30640101).
     43    [CallWith=ScriptState&ScriptExecutionContext, ImplementedAs=initMouseEventQuirk] void initMouseEvent(optional DOMString type = "undefined", optional boolean canBubble = false,  optional boolean cancelable = false,
    4344        optional DOMWindow? view = null, optional long detail = 0,
    4445        optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0,
    4546        optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false,
    46         optional unsigned short button = 0, optional EventTarget? relatedTarget = null);
     47        optional unsigned short button = 0, optional any relatedTarget = null);
    4748
    4849    readonly attribute long offsetX;
  • branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.h

    r210332 r212819  
    5454WEBCORE_EXPORT bool isHRBlock();
    5555WEBCORE_EXPORT bool isAppStore();
     56WEBCORE_EXPORT bool isIAdProducer();
    5657
    5758} // MacApplication
  • branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.mm

    r210332 r212819  
    149149}
    150150
     151bool MacApplication::isIAdProducer()
     152{
     153    static bool isIAdProducer = applicationBundleIsEqualTo("com.apple.iAdProducer");
     154    return isIAdProducer;
     155}
     156
    151157bool MacApplication::isSolidStateNetworksDownloader()
    152158{
Note: See TracChangeset for help on using the changeset viewer.