Changeset 95574 in webkit


Ignore:
Timestamp:
Sep 20, 2011 3:33:48 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

Hit testing on margins of body and head elements doesn't recur
https://bugs.webkit.org/show_bug.cgi?id=40753

Reviewed by Darin Adler.

Source/WebCore:

The bug was caused by positionForPointRespectingEditingBoundaries's comparing the editability
of head/body and html elements when hit testing was done inside margins of head and body elements.

Fixed the bug by special-casing html element since margins of head and body elements are special.

Tests: editing/selection/click-on-body-margin.html

editing/selection/click-on-head-margin.html

  • rendering/RenderBlock.cpp:

(WebCore::positionForPointRespectingEditingBoundaries):

LayoutTests:

Add tests to click on margins of head and body elements. WebKit should not
(attempt to) place the caret after or before head and body elements.

  • editing/selection/click-on-body-margin-expected.txt: Added.
  • editing/selection/click-on-body-margin.html: Added.
  • editing/selection/click-on-head-margin-expected.txt: Added.
  • editing/selection/click-on-head-margin.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95571 r95574  
     12011-09-20  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Hit testing on margins of body and head elements doesn't recur
     4        https://bugs.webkit.org/show_bug.cgi?id=40753
     5
     6        Reviewed by Darin Adler.
     7
     8        Add tests to click on margins of head and body elements. WebKit should not
     9        (attempt to) place the caret after or before head and body elements.
     10
     11        * editing/selection/click-on-body-margin-expected.txt: Added.
     12        * editing/selection/click-on-body-margin.html: Added.
     13        * editing/selection/click-on-head-margin-expected.txt: Added.
     14        * editing/selection/click-on-head-margin.html: Added.
     15
    1162011-09-20  Alan Stearns  <stearns@adobe.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r95573 r95574  
     12011-09-20  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Hit testing on margins of body and head elements doesn't recur
     4        https://bugs.webkit.org/show_bug.cgi?id=40753
     5
     6        Reviewed by Darin Adler.
     7
     8        The bug was caused by positionForPointRespectingEditingBoundaries's comparing the editability
     9        of head/body and html elements when hit testing was done inside margins of head and body elements.
     10
     11        Fixed the bug by special-casing html element since margins of head and body elements are special.
     12
     13        Tests: editing/selection/click-on-body-margin.html
     14               editing/selection/click-on-head-margin.html
     15
     16        * rendering/RenderBlock.cpp:
     17        (WebCore::positionForPointRespectingEditingBoundaries):
     18
    1192011-09-20  David Hyatt  <hyatt@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r95550 r95574  
    42104210}
    42114211
     4212static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child)
     4213{
     4214    ASSERT(!ancestor || ancestor->node());
     4215    ASSERT(child && child->node());
     4216    return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor->parent()->isRenderView())
     4217        || ancestor->node()->rendererIsEditable() == child->node()->rendererIsEditable();
     4218}
     4219
    42124220// FIXME: This function should go on RenderObject as an instance method. Then
    42134221// all cases in which positionForPoint recurs could call this instead to
     
    42334241
    42344242    // If we can't find an ancestor to check editability on, or editability is unchanged, we recur like normal
    4235     if (!ancestor || ancestor->node()->rendererIsEditable() == childNode->rendererIsEditable())
     4243    if (isEditingBoundary(ancestor, child))
    42364244        return child->positionForPoint(pointInChildCoordinates);
    42374245
Note: See TracChangeset for help on using the changeset viewer.