Changeset 185955 in webkit


Ignore:
Timestamp:
Jun 25, 2015, 10:42:00 AM (10 years ago)
Author:
Alan Bujtas
Message:

Do not send touch events to the slider's thumb when it does not have a renderer.
https://bugs.webkit.org/show_bug.cgi?id=146307
rdar://problem/21539399

Reviewed by Simon Fraser.

Bail out early if either the touch target or the renderer() is null.

Source/WebCore:

Test: fast/events/touch/input-range-with-thumb-display-none-crash.html

  • html/shadow/SliderThumbElement.cpp:

(WebCore::findTouchWithIdentifier):
(WebCore::SliderThumbElement::handleTouchStart):
(WebCore::SliderThumbElement::handleTouchMove):
(WebCore::SliderThumbElement::handleTouchEndAndCancel):

LayoutTests:

  • fast/events/touch/input-range-with-thumb-display-none-crash-expected.txt: Added.
  • fast/events/touch/input-range-with-thumb-display-none-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185954 r185955  
     12015-06-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not send touch events to the slider's thumb when it does not have a renderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=146307
     5        rdar://problem/21539399
     6
     7        Reviewed by Simon Fraser.
     8
     9        Bail out early if either the touch target or the renderer() is null.
     10
     11        * fast/events/touch/input-range-with-thumb-display-none-crash-expected.txt: Added.
     12        * fast/events/touch/input-range-with-thumb-display-none-crash.html: Added.
     13
    1142015-06-25  Michael Saboff  <msaboff@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r185953 r185955  
     12015-06-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not send touch events to the slider's thumb when it does not have a renderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=146307
     5        rdar://problem/21539399
     6
     7        Reviewed by Simon Fraser.
     8
     9        Bail out early if either the touch target or the renderer() is null.
     10
     11        Test: fast/events/touch/input-range-with-thumb-display-none-crash.html
     12
     13        * html/shadow/SliderThumbElement.cpp:
     14        (WebCore::findTouchWithIdentifier):
     15        (WebCore::SliderThumbElement::handleTouchStart):
     16        (WebCore::SliderThumbElement::handleTouchMove):
     17        (WebCore::SliderThumbElement::handleTouchEndAndCancel):
     18
    1192015-06-25  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
    220
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp

    r183975 r185955  
    419419}
    420420
    421 static Touch* findTouchWithIdentifier(TouchList* list, unsigned identifier)
    422 {
    423     unsigned length = list->length();
     421static Touch* findTouchWithIdentifier(TouchList& list, unsigned identifier)
     422{
     423    unsigned length = list.length();
    424424    for (unsigned i = 0; i < length; ++i) {
    425         Touch* touch = list->item(i);
     425        Touch* touch = list.item(i);
    426426        if (touch->identifier() == identifier)
    427427            return touch;
     
    433433{
    434434    TouchList* targetTouches = touchEvent->targetTouches();
     435    if (!targetTouches)
     436        return;
     437
    435438    if (targetTouches->length() != 1)
    436439        return;
    437440
     441    Touch* touch = targetTouches->item(0);
     442    if (!renderer())
     443        return;
     444    IntRect boundingBox = renderer()->absoluteBoundingBoxRect();
    438445    // Ignore the touch if it is not really inside the thumb.
    439     Touch* touch = targetTouches->item(0);
    440     IntRect boundingBox = renderer()->absoluteBoundingBoxRect();
    441446    if (!boundingBox.contains(touch->pageX(), touch->pageY()))
    442447        return;
     
    454459        return;
    455460
    456     Touch* touch = findTouchWithIdentifier(touchEvent->targetTouches(), identifier);
     461    TouchList* targetTouches = touchEvent->targetTouches();
     462    if (!targetTouches)
     463        return;
     464
     465    Touch* touch = findTouchWithIdentifier(*targetTouches, identifier);
    457466    if (!touch)
    458467        return;
     
    469478        return;
    470479
     480    TouchList* targetTouches = touchEvent->targetTouches();
     481    if (!targetTouches)
     482        return;
    471483    // If our exclusive touch still exists, it was not the touch
    472484    // that ended, so we should not stop dragging.
    473     Touch* exclusiveTouch = findTouchWithIdentifier(touchEvent->targetTouches(), identifier);
     485    Touch* exclusiveTouch = findTouchWithIdentifier(*targetTouches, identifier);
    474486    if (exclusiveTouch)
    475487        return;
Note: See TracChangeset for help on using the changeset viewer.