Changeset 127421 in webkit


Ignore:
Timestamp:
Sep 3, 2012 7:41:42 AM (12 years ago)
Author:
allan.jensen@nokia.com
Message:

Move AllowShadowContent flag to HitTestRequest
https://bugs.webkit.org/show_bug.cgi?id=95685

Reviewed by Antonio Gomes.

Moves the flag and updates the interface for HitTestResult::addNodeToRectBasedTestResult so that
it can read the flag from HitTestRequest instead of from HitTestResult.

No change in functionality. No new tests.

  • dom/Document.cpp:

(WebCore::Document::nodesFromRect):

  • page/EventHandler.cpp:

(WebCore::EventHandler::hitTestResultAtPoint):

  • rendering/HitTestRequest.h:
  • rendering/HitTestResult.cpp:

(WebCore::HitTestLocation::HitTestLocation):
(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::operator=):
(WebCore::HitTestResult::addNodeToRectBasedTestResult):

  • rendering/HitTestResult.h:

(HitTestLocation):
(HitTestResult):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::nodeAtPoint):

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::nodeAtPoint):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::nodeAtPoint):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::nodeAtPoint):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::nodeAtPoint):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestList):

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::nodeAtPoint):

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::nodeAtPoint):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::nodeAtPoint):

  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::nodeAtPoint):

  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::nodeAtPoint):

Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127418 r127421  
     12012-09-03  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        Move AllowShadowContent flag to HitTestRequest
     4        https://bugs.webkit.org/show_bug.cgi?id=95685
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Moves the flag and updates the interface for HitTestResult::addNodeToRectBasedTestResult so that
     9        it can read the flag from HitTestRequest instead of from HitTestResult.
     10
     11        No change in functionality. No new tests.
     12
     13        * dom/Document.cpp:
     14        (WebCore::Document::nodesFromRect):
     15        * page/EventHandler.cpp:
     16        (WebCore::EventHandler::hitTestResultAtPoint):
     17        * rendering/HitTestRequest.h:
     18        * rendering/HitTestResult.cpp:
     19        (WebCore::HitTestLocation::HitTestLocation):
     20        (WebCore::HitTestResult::HitTestResult):
     21        (WebCore::HitTestResult::operator=):
     22        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
     23        * rendering/HitTestResult.h:
     24        (HitTestLocation):
     25        (HitTestResult):
     26        * rendering/InlineFlowBox.cpp:
     27        (WebCore::InlineFlowBox::nodeAtPoint):
     28        * rendering/InlineTextBox.cpp:
     29        (WebCore::InlineTextBox::nodeAtPoint):
     30        * rendering/RenderBlock.cpp:
     31        (WebCore::RenderBlock::nodeAtPoint):
     32        * rendering/RenderBox.cpp:
     33        (WebCore::RenderBox::nodeAtPoint):
     34        * rendering/RenderImage.cpp:
     35        (WebCore::RenderImage::nodeAtPoint):
     36        * rendering/RenderLayer.cpp:
     37        (WebCore::RenderLayer::hitTestLayer):
     38        (WebCore::RenderLayer::hitTestList):
     39        * rendering/RenderMultiColumnSet.cpp:
     40        (WebCore::RenderMultiColumnSet::nodeAtPoint):
     41        * rendering/RenderRegion.cpp:
     42        (WebCore::RenderRegion::nodeAtPoint):
     43        * rendering/RenderTable.cpp:
     44        (WebCore::RenderTable::nodeAtPoint):
     45        * rendering/svg/RenderSVGRoot.cpp:
     46        (WebCore::RenderSVGRoot::nodeAtPoint):
     47        * rendering/svg/SVGInlineTextBox.cpp:
     48        (WebCore::SVGInlineTextBox::nodeAtPoint):
     49
    1502012-09-03  Alexander Pavlov  <apavlov@chromium.org>
    251
  • trunk/Source/WebCore/dom/Document.cpp

    r127228 r127421  
    14071407    else if (!frameView->visibleContentRect().intersects(HitTestResult::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
    14081408        return 0;
     1409    if (allowShadowContent)
     1410        type |= HitTestRequest::AllowShadowContent;
    14091411
    14101412    HitTestRequest request(type);
     
    14171419    }
    14181420
    1419     enum ShadowContentFilterPolicy shadowContentFilterPolicy = allowShadowContent ? AllowShadowContent : DoNotAllowShadowContent;
    1420     HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding, shadowContentFilterPolicy);
     1421    HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding);
    14211422    renderView()->hitTest(request, result);
    14221423
  • trunk/Source/WebCore/page/EventHandler.cpp

    r126926 r127421  
    10421042HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
    10431043{
    1044     enum ShadowContentFilterPolicy shadowContentFilterPolicy = allowShadowContent ? AllowShadowContent : DoNotAllowShadowContent;
    1045     HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width(), shadowContentFilterPolicy);
     1044    HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());
    10461045
    10471046    if (!m_frame->contentRenderer())
     
    10491048    if (ignoreClipping)
    10501049        hitType |= HitTestRequest::IgnoreClipping;
     1050    if (allowShadowContent)
     1051        hitType |= HitTestRequest::AllowShadowContent;
    10511052    m_frame->contentRenderer()->hitTest(HitTestRequest(hitType), result);
    10521053
     
    10651066        LayoutPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(),
    10661067            result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop());
    1067         HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width(), shadowContentFilterPolicy);
     1068        HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width());
    10681069        frame->contentRenderer()->hitTest(HitTestRequest(hitType), widgetHitTestResult);
    10691070        result = widgetHitTestResult;
  • trunk/Source/WebCore/rendering/HitTestRequest.h

    r106554 r127421  
    3535        IgnoreClipping = 1 << 5,
    3636        SVGClipContent = 1 << 6,
    37         TouchEvent = 1 << 7
     37        TouchEvent = 1 << 7,
     38        AllowShadowContent = 1 << 8
    3839    };
    3940
     
    5354    bool touchEvent() const { return m_requestType & TouchEvent; }
    5455    bool mouseEvent() const { return !touchEvent(); }
     56    bool allowsShadowContent() const { return m_requestType & AllowShadowContent; }
    5557
    5658    // Convenience functions
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r126859 r127421  
    105105    , m_transformedPoint(other.m_transformedPoint)
    106106    , m_transformedRect(other.m_transformedRect)
    107     , m_region(region)
    108107    , m_isRectBased(other.m_isRectBased)
    109108    , m_isRectilinear(other.m_isRectilinear)
     
    195194HitTestResult::HitTestResult() : HitTestLocation()
    196195    , m_isOverWidget(false)
    197     , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
    198196{
    199197}
     
    201199HitTestResult::HitTestResult(const LayoutPoint& point) : HitTestLocation(point)
    202200    , m_isOverWidget(false)
    203     , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
    204 {
    205 }
    206 
    207 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, ShadowContentFilterPolicy allowShadowContent)
     201{
     202}
     203
     204HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
    208205    : HitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
    209206    , m_isOverWidget(false)
    210     , m_shadowContentFilterPolicy(allowShadowContent)
    211 {
    212 }
    213 
    214 HitTestResult::HitTestResult(const HitTestLocation& other, ShadowContentFilterPolicy allowShadowContent)
     207{
     208}
     209
     210HitTestResult::HitTestResult(const HitTestLocation& other)
    215211    : HitTestLocation(other)
    216212    , m_isOverWidget(false)
    217     , m_shadowContentFilterPolicy(allowShadowContent)
    218213{
    219214}
     
    227222    , m_scrollbar(other.scrollbar())
    228223    , m_isOverWidget(other.isOverWidget())
    229     , m_shadowContentFilterPolicy(other.shadowContentFilterPolicy())
    230224{
    231225    // Only copy the NodeSet in case of rect hit test.
     
    249243    // Only copy the NodeSet in case of rect hit test.
    250244    m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0);
    251     m_shadowContentFilterPolicy  = other.shadowContentFilterPolicy();
    252245
    253246    return *this;
     
    675668}
    676669
    677 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestLocation& locationInContainer, const LayoutRect& rect)
     670bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const LayoutRect& rect)
    678671{
    679672    // If it is not a rect-based hit test, this method has to be no-op.
     
    686679        return true;
    687680
    688     if (m_shadowContentFilterPolicy == DoNotAllowShadowContent)
     681    if (!request.allowsShadowContent())
    689682        node = node->shadowAncestorNode();
    690683
     
    710703}
    711704
    712 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestLocation& locationInContainer, const FloatRect& rect)
     705bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const FloatRect& rect)
    713706{
    714707    // If it is not a rect-based hit test, this method has to be no-op.
     
    721714        return true;
    722715
    723     if (m_shadowContentFilterPolicy == DoNotAllowShadowContent)
     716    if (!request.allowsShadowContent())
    724717        node = node->shadowAncestorNode();
    725718
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r126859 r127421  
    4545class RenderRegion;
    4646class Scrollbar;
    47 
    48 enum ShadowContentFilterPolicy { DoNotAllowShadowContent, AllowShadowContent };
    4947
    5048class HitTestLocation {
     
    110108    HitTestResult(const LayoutPoint&);
    111109    // Pass non-negative padding values to perform a rect-based hit test.
    112     HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, ShadowContentFilterPolicy);
    113     HitTestResult(const HitTestLocation&, ShadowContentFilterPolicy);
     110    HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     111    HitTestResult(const HitTestLocation&);
    114112    HitTestResult(const HitTestResult&);
    115113    ~HitTestResult();
     
    126124
    127125    const HitTestLocation& hitTestLocation() const { return *this; }
    128     ShadowContentFilterPolicy shadowContentFilterPolicy() const { return m_shadowContentFilterPolicy; }
    129126
    130127    void setInnerNode(Node*);
     
    167164    // Returns true if it is rect-based hit test and needs to continue until the rect is fully
    168165    // enclosed by the boundaries of a node.
    169     bool addNodeToRectBasedTestResult(Node*, const HitTestLocation& locationInContainer, const LayoutRect& = LayoutRect());
    170     bool addNodeToRectBasedTestResult(Node*, const HitTestLocation& locationInContainer, const FloatRect&);
     166    bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTestLocation& pointInContainer, const LayoutRect& = LayoutRect());
     167    bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTestLocation& pointInContainer, const FloatRect&);
    171168    void append(const HitTestResult&);
    172169
     
    195192    bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
    196193
    197     ShadowContentFilterPolicy m_shadowContentFilterPolicy;
    198 
    199194    mutable OwnPtr<NodeSet> m_rectBasedTestResult;
    200195};
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r127300 r127421  
    10141014    if (visibleToHitTesting() && locationInContainer.intersects(rect)) {
    10151015        renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y here, we want coords in the containing block's space.
    1016         if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))
     1016        if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect))
    10171017            return true;
    10181018    }
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r126859 r127421  
    350350}
    351351
    352 bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
     352bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
    353353{
    354354    if (isLineBreak())
     
    360360    if (m_truncation != cFullTruncation && visibleToHitTesting() && locationInContainer.intersects(rect)) {
    361361        renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)));
    362         if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))
     362        if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect))
    363363            return true;
    364364    }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r127346 r127421  
    47054705        updateHitTestResult(result, locationInContainer.point() - localOffset);
    47064706        // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet.
    4707         if (!result.addNodeToRectBasedTestResult(node(), locationInContainer))
     4707        if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer))
    47084708           return true;
    47094709    }
     
    47384738        if (visibleToHitTesting() && locationInContainer.intersects(boundsRect)) {
    47394739            updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset));
    4740             if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))
     4740            if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect))
    47414741                return true;
    47424742        }
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r127346 r127421  
    757757    if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
    758758        updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
    759         if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))
     759        if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect))
    760760            return true;
    761761    }
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r126859 r127421  
    502502bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
    503503{
    504     HitTestResult tempResult(result.hitTestLocation(), result.shadowContentFilterPolicy());
     504    HitTestResult tempResult(result.hitTestLocation());
    505505    bool inside = RenderReplaced::nodeAtPoint(request, tempResult, locationInContainer, accumulatedOffset, hitTestAction);
    506506
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r127162 r127421  
    36983698    if (fgRect.intersects(hitTestLocation) && isSelfPaintingLayer()) {
    36993699        // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost.
    3700         HitTestResult tempResult(result.hitTestLocation(), result.shadowContentFilterPolicy());
     3700        HitTestResult tempResult(result.hitTestLocation());
    37013701        if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestDescendants)
    37023702            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
     
    37273727
    37283728    if (bgRect.intersects(hitTestLocation) && isSelfPaintingLayer()) {
    3729         HitTestResult tempResult(result.hitTestLocation(), result.shadowContentFilterPolicy());
     3729        HitTestResult tempResult(result.hitTestLocation());
    37303730        if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestSelf)
    37313731            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
     
    37843784        RenderLayer* childLayer = list->at(i);
    37853785        RenderLayer* hitLayer = 0;
    3786         HitTestResult tempResult(result.hitTestLocation(), result.shadowContentFilterPolicy());
     3786        HitTestResult tempResult(result.hitTestLocation());
    37873787        if (childLayer->isPaginated())
    37883788            hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendants);
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r127297 r127421  
    319319   
    320320    updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
    321     return !result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect);
     321    return !result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect);
    322322}
    323323
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r127280 r127421  
    151151            return true;
    152152        updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
    153         if (!result.addNodeToRectBasedTestResult(generatingNode(), locationInContainer, boundsRect))
     153        if (!result.addNodeToRectBasedTestResult(generatingNode(), request, locationInContainer, boundsRect))
    154154            return true;
    155155    }
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r127157 r127421  
    12931293    if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && locationInContainer.intersects(boundsRect)) {
    12941294        updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(adjustedLocation)));
    1295         if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))
     1295        if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect))
    12961296            return true;
    12971297    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r126859 r127421  
    430430            if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
    431431                updateHitTestResult(result, pointInBorderBox);
    432                 if (!result.addNodeToRectBasedTestResult(child->node(), locationInContainer))
     432                if (!result.addNodeToRectBasedTestResult(child->node(), request, locationInContainer))
    433433                    return true;
    434434            }
     
    445445        if (locationInContainer.intersects(boundsRect)) {
    446446            updateHitTestResult(result, pointInBorderBox);
    447             if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))
     447            if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect))
    448448                return true;
    449449        }
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r126859 r127421  
    717717            if (locationInContainer.intersects(rect)) {
    718718                renderer()->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
    719                 if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))
     719                if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect))
    720720                    return true;
    721721             }
Note: See TracChangeset for help on using the changeset viewer.