Changeset 117555 in webkit


Ignore:
Timestamp:
May 18, 2012 12:37:01 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Qt] Gesture tap highlighter needs to take overflow clip into account.
https://bugs.webkit.org/show_bug.cgi?id=84989

Patch by Zalan Bujtas <zbujtas@gmail.com> on 2012-05-18
Reviewed by Kenneth Rohde Christiansen.

.:

  • ManualTests/qt/tap-highlighting-overflow-hidden.html: Added.

Source/WebCore:

Apply overflow clip on the focus ring if needed.

Follow up patches are needed to address the following cases.

[Qt] Gesture tap highlighter should take parent iframe's transform into account.
https://bugs.webkit.org/show_bug.cgi?id=86645

[Qt] Gesture tap highlighter needs to take frame clipping into account.
https://bugs.webkit.org/show_bug.cgi?id=86646

[Qt] Gesture tap highlighter's overflow clip is not always correct when
nested enclosing containers have transforms.
https://bugs.webkit.org/show_bug.cgi?id=86641

Manual test: ManualTests/qt/tap-highlighting-overflow-hidden.html

  • page/GestureTapHighlighter.cpp:

(WebCore::GestureTapHighlighter::pathForNodeHighlight):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r117551 r117555  
     12012-05-18  Zalan Bujtas  <zbujtas@gmail.com>
     2
     3        [Qt] Gesture tap highlighter needs to take overflow clip into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=84989
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * ManualTests/qt/tap-highlighting-overflow-hidden.html: Added.
     9
    1102012-05-18  Christophe Dumez  <christophe.dumez@intel.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r117549 r117555  
     12012-05-18  Zalan Bujtas  <zbujtas@gmail.com>
     2
     3        [Qt] Gesture tap highlighter needs to take overflow clip into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=84989
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Apply overflow clip on the focus ring if needed.
     9
     10        Follow up patches are needed to address the following cases.
     11
     12        [Qt] Gesture tap highlighter should take parent iframe's transform into account.
     13        https://bugs.webkit.org/show_bug.cgi?id=86645
     14
     15        [Qt] Gesture tap highlighter needs to take frame clipping into account.
     16        https://bugs.webkit.org/show_bug.cgi?id=86646
     17
     18        [Qt] Gesture tap highlighter's overflow clip is not always correct when
     19        nested enclosing containers have transforms.
     20        https://bugs.webkit.org/show_bug.cgi?id=86641
     21
     22        Manual test: ManualTests/qt/tap-highlighting-overflow-hidden.html
     23
     24        * page/GestureTapHighlighter.cpp:
     25        (WebCore::GestureTapHighlighter::pathForNodeHighlight):
     26
    1272012-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
    228
  • trunk/Source/WebCore/page/GestureTapHighlighter.cpp

    r113990 r117555  
    4040#include "RenderBoxModelObject.h"
    4141#include "RenderInline.h"
     42#include "RenderLayer.h"
    4243#include "RenderObject.h"
    4344
     
    135136}
    136137
    137 Path pathForRenderer(RenderObject* o)
     138Path absolutePathForRenderer(RenderObject* const o)
    138139{
    139140    ASSERT(o);
    140     Path path;
    141141
    142142    Vector<IntRect> rects;
    143     o->addFocusRingRects(rects, /* acc. offset */ ownerFrameToMainFrameOffset(o));
     143    LayoutPoint frameOffset = ownerFrameToMainFrameOffset(o);
     144    o->addFocusRingRects(rects, frameOffset);
    144145
    145146    if (rects.isEmpty())
    146         return path;
     147        return Path();
    147148
    148149    // The basic idea is to allow up to three different boxes in order to highlight
     
    185186    }
    186187
     188    // Clip the overflow rects if needed, before the ring path is formed to
     189    // ensure rounded highlight rects. This clipping has the problem with nested
     190    // divs with transforms, which could be resolved by proper Path::intersecting.
     191    for (int i = drawableRects.size() - 1; i >= 0; --i) {
     192        LayoutRect& ringRect = drawableRects.at(i);
     193        LayoutPoint ringRectLocation = ringRect.location();
     194
     195        ringRect.moveBy(-frameOffset);
     196
     197        RenderLayer* layer = o->enclosingLayer();
     198        RenderObject* currentRenderer = o;
     199
     200        // Check ancestor layers for overflow clip and intersect them.
     201        while (layer) {
     202            RenderObject* layerRenderer = layer->renderer();
     203
     204            if (layerRenderer->hasOverflowClip() && layerRenderer != currentRenderer) {
     205                ringRect.move(currentRenderer->offsetFromAncestorContainer(layerRenderer));
     206                currentRenderer = layerRenderer;
     207
     208                ASSERT(layerRenderer->isBox());
     209                ringRect.intersect(toRenderBox(layerRenderer)->borderBoxRect());
     210
     211                if (ringRect.isEmpty())
     212                    break;
     213            }
     214            layer = layer->parent();
     215        }
     216
     217        if (ringRect.isEmpty()) {
     218            drawableRects.remove(i);
     219            continue;
     220        }
     221        // After clipping, reset the original position so that parents' transforms apply correctly.
     222        ringRect.setLocation(ringRectLocation);
     223    }
     224
     225    Path path;
    187226    for (size_t i = 0; i < drawableRects.size(); ++i) {
    188227        LayoutRect prev = i ? drawableRects.at(i - 1) : LayoutRect();
     
    191230    }
    192231
     232    path.transform(localToAbsoluteTransform(o));
    193233    return path;
    194234}
     
    202242    RenderObject* renderer = node->renderer();
    203243
    204     Path path;
    205244    if (!renderer || (!renderer->isBox() && !renderer->isRenderInline()))
    206         return path;
    207 
    208     path = pathForRenderer(renderer);
    209     path.transform(localToAbsoluteTransform(renderer));
    210 
    211     return path;
     245        return Path();
     246
     247    return absolutePathForRenderer(renderer);
    212248}
    213249
Note: See TracChangeset for help on using the changeset viewer.