Changeset 91573 in webkit


Ignore:
Timestamp:
Jul 22, 2011 10:46:12 AM (13 years ago)
Author:
tkent@chromium.org
Message:

Validation message bubble is incorrectly positioned in a relative body.
https://bugs.webkit.org/show_bug.cgi?id=65018

Reviewed by Dimitri Glazkov.

Source/WebCore:

We use position:aboslute for validation message bubbles, and the
origin of the absolute position can be not only the page, but also
an ancestor block with non-static position.

Test: fast/forms/validation-message-in-relative-body.html

  • html/ValidationMessage.cpp:

(WebCore::adjustBubblePosition):
Subtract the containing block position from the host position.
(WebCore::ValidationMessage::buildBubbleTree):
Change the order of appendChild() and adjustBubblePosition() in
order to use RenderObject::containingBlock() in
adjustbubbleposition().

LayoutTests:

  • fast/forms/validation-message-in-relative-body-expected.txt: Added.
  • fast/forms/validation-message-in-relative-body.html: Added.
  • platform/gtk/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r91569 r91573  
     12011-07-22  Kent Tamura  <tkent@chromium.org>
     2
     3        Validation message bubble is incorrectly positioned in a relative body.
     4        https://bugs.webkit.org/show_bug.cgi?id=65018
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        * fast/forms/validation-message-in-relative-body-expected.txt: Added.
     9        * fast/forms/validation-message-in-relative-body.html: Added.
     10        * platform/gtk/Skipped:
     11        * platform/qt/Skipped:
     12        * platform/win/Skipped:
     13
    1142011-07-22  Andrey Kosyakov  <caseq@chromium.org>
    215
  • trunk/LayoutTests/platform/gtk/Skipped

    r91408 r91573  
    12441244fast/forms/validation-message-appearance.html
    12451245fast/forms/validation-message-clone.html
     1246fast/forms/validation-message-in-relative-body.html
    12461247fast/forms/validation-message-on-checkbox.html
    12471248fast/forms/validation-message-on-listbox.html
  • trunk/LayoutTests/platform/qt/Skipped

    r91459 r91573  
    20342034fast/forms/validation-message-appearance.html
    20352035fast/forms/validation-message-clone.html
     2036fast/forms/validation-message-in-relative-body.html
    20362037fast/forms/validation-message-on-checkbox.html
    20372038fast/forms/validation-message-on-listbox.html
  • trunk/LayoutTests/platform/win/Skipped

    r91525 r91573  
    11251125fast/forms/validation-message-appearance.html
    11261126fast/forms/validation-message-clone.html
     1127fast/forms/validation-message-in-relative-body.html
    11271128fast/forms/validation-message-on-checkbox.html
    11281129fast/forms/validation-message-on-listbox.html
  • trunk/Source/WebCore/ChangeLog

    r91571 r91573  
     12011-07-22  Kent Tamura  <tkent@chromium.org>
     2
     3        Validation message bubble is incorrectly positioned in a relative body.
     4        https://bugs.webkit.org/show_bug.cgi?id=65018
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        We use position:aboslute for validation message bubbles, and the
     9        origin of the absolute position can be not only the page, but also
     10        an ancestor block with non-static position.
     11
     12        Test: fast/forms/validation-message-in-relative-body.html
     13
     14        * html/ValidationMessage.cpp:
     15        (WebCore::adjustBubblePosition):
     16        Subtract the containing block position from the host position.
     17        (WebCore::ValidationMessage::buildBubbleTree):
     18        Change the order of appendChild() and adjustBubblePosition() in
     19        order to use RenderObject::containingBlock() in
     20        adjustbubbleposition().
     21
    1222011-07-22  David Grogan  <dgrogan@chromium.org>
    223
  • trunk/Source/WebCore/html/ValidationMessage.cpp

    r90071 r91573  
    4040#include "HTMLNames.h"
    4141#include "Page.h"
     42#include "RenderBlock.h"
    4243#include "RenderObject.h"
    4344#include "Settings.h"
     
    111112    if (hostRect.isEmpty())
    112113        return;
    113     bubble->getInlineStyleDecl()->setProperty(CSSPropertyTop, static_cast<double>(hostRect.y() + hostRect.height()), CSSPrimitiveValue::CSS_PX);
     114    double hostX = hostRect.x();
     115    double hostY = hostRect.y();
     116    if (RenderBox* container = bubble->renderer()->containingBlock()) {
     117        FloatPoint containerLocation = container->localToAbsolute();
     118        hostX -= containerLocation.x() + container->borderLeft() + container->paddingLeft();
     119        hostY -= containerLocation.y() + container->borderTop() + container->paddingTop();
     120    }
     121    bubble->getInlineStyleDecl()->setProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX);
    114122    // The 'left' value of ::-webkit-validation-bubble-arrow.
    115123    const int bubbleArrowTopOffset = 32;
    116     double bubbleX = hostRect.x();
     124    double bubbleX = hostX;
    117125    if (hostRect.width() / 2 < bubbleArrowTopOffset)
    118         bubbleX = max(hostRect.x() + hostRect.width() / 2 - bubbleArrowTopOffset, 0);
     126        bubbleX = max(hostX + hostRect.width() / 2 - bubbleArrowTopOffset, 0.0);
    119127    bubble->getInlineStyleDecl()->setProperty(CSSPropertyLeft, bubbleX, CSSPrimitiveValue::CSS_PX);
    120128}
     
    131139    // contains non-absolute or non-fixed renderers as children.
    132140    m_bubble->getInlineStyleDecl()->setProperty(CSSPropertyPosition, CSSValueAbsolute);
    133     adjustBubblePosition(host->getRect(), m_bubble.get());
    134141    host->ensureShadowRoot()->appendChild(m_bubble.get(), ec);
    135142    ASSERT(!ec);
     143    adjustBubblePosition(host->getRect(), m_bubble.get());
    136144
    137145    RefPtr<HTMLDivElement> clipper = HTMLDivElement::create(doc);
Note: See TracChangeset for help on using the changeset viewer.