Changeset 92118 in webkit


Ignore:
Timestamp:
Aug 1, 2011 4:18:15 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

BORDER attribute with the object tag, using percentage values not working.
https://bugs.webkit.org/show_bug.cgi?id=65176

Patch by Mihnea Ovidenie <mihnea@adobe.com> on 2011-08-01
Reviewed by Hajime Morita.

Source/WebCore:

When border presentational attribute for object element has % in it, it should be parsed using HTML parser rules.

Test: fast/borders/border-width-percent.html

  • html/HTMLElement.cpp:

(WebCore::HTMLElement::parseBorderWidthAttribute):

  • html/HTMLElement.h:
  • html/HTMLImageElement.cpp:
  • html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::parseMappedAttribute):

LayoutTests:

Added the tests with border width with percentages in a new file. Moved them
from images border test file.

  • fast/borders/border-width-percent-expected.txt: Added.
  • fast/borders/border-width-percent.html: Added.
  • fast/images/border-expected.txt:
  • fast/images/script-tests/border.js:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r92117 r92118  
     12011-08-01  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        BORDER attribute with the object tag, using percentage values not working.
     4        https://bugs.webkit.org/show_bug.cgi?id=65176
     5
     6        Reviewed by Hajime Morita.
     7
     8        Added the tests with border width with percentages in a new file. Moved them
     9        from images border test file.
     10
     11        * fast/borders/border-width-percent-expected.txt: Added.
     12        * fast/borders/border-width-percent.html: Added.
     13        * fast/images/border-expected.txt:
     14        * fast/images/script-tests/border.js:
     15
    1162011-08-01  Tony Gentilcore  <tonyg@chromium.org>
    217
  • trunk/LayoutTests/fast/images/border-expected.txt

    r91601 r92118  
    2222PASS imageBorderWidth('10q ') is 10
    2323PASS imageBorderWidth(' 10q ') is 10
    24 PASS imageBorderWidth('10%') is 10
    25 PASS imageBorderWidth('-10%') is 0
    26 PASS imageBorderWidth(' +10%') is 10
    27 PASS imageBorderWidth(0, 'border-width: 10%') is 0
    28 PASS imageBorderWidth(0, 'border-width: -10%') is 0
    2924PASS successfullyParsed is true
    3025
  • trunk/LayoutTests/fast/images/script-tests/border.js

    r91601 r92118  
    3737shouldBe("imageBorderWidth(' 10q ')", "10");
    3838
    39 shouldBe("imageBorderWidth('10%')", "10");
    40 shouldBe("imageBorderWidth('-10%')", "0");
    41 shouldBe("imageBorderWidth(' +10%')", "10");
    42 
    43 shouldBe("imageBorderWidth(0, 'border-width: 10%')", "0");
    44 shouldBe("imageBorderWidth(0, 'border-width: -10%')", "0");
    45 
    4639var successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r92116 r92118  
     12011-08-01  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        BORDER attribute with the object tag, using percentage values not working.
     4        https://bugs.webkit.org/show_bug.cgi?id=65176
     5
     6        Reviewed by Hajime Morita.
     7
     8        When border presentational attribute for object element has % in it, it should be parsed using HTML parser rules.
     9
     10        Test: fast/borders/border-width-percent.html
     11
     12        * html/HTMLElement.cpp:
     13        (WebCore::HTMLElement::parseBorderWidthAttribute):
     14        * html/HTMLElement.h:
     15        * html/HTMLImageElement.cpp:
     16        * html/HTMLObjectElement.cpp:
     17        (WebCore::HTMLObjectElement::parseMappedAttribute):
     18
    1192011-08-01  Yuta Kitamura  <yutak@chromium.org>
    220
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r89864 r92118  
    134134        return CSSValueWebkitPlaintext;
    135135    return CSSValueEmbed;
     136}
     137
     138unsigned HTMLElement::parseBorderWidthAttribute(Attribute* attr)
     139{
     140    ASSERT(attr && attr->name() == borderAttr);
     141
     142    unsigned borderWidth = 0;
     143    if (!attr->value().isEmpty())
     144        parseHTMLNonNegativeInteger(attr->value(), borderWidth);
     145
     146    return borderWidth;
    136147}
    137148
  • trunk/Source/WebCore/html/HTMLElement.h

    r87125 r92118  
    9191    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
    9292    virtual void parseMappedAttribute(Attribute*);
     93    unsigned parseBorderWidthAttribute(Attribute*);
    9394
    9495    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r91601 r92118  
    9797
    9898    return HTMLElement::mapToEntry(attrName, result);
    99 }
    100 
    101 static unsigned int parseBorderWidthAttribute(Attribute* attr)
    102 {
    103     ASSERT(attr && attr->name() == borderAttr);
    104 
    105     unsigned int borderWidth = 0;
    106     if (!attr->value().isEmpty() && !attr->value().isNull())
    107         parseHTMLNonNegativeInteger(attr->value(), borderWidth);
    108 
    109     return borderWidth;
    11099}
    111100
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r91404 r92118  
    122122        m_name = newName;
    123123    } else if (attr->name() == borderAttr) {
    124         addCSSLength(attr, CSSPropertyBorderWidth, attr->value().toInt() ? attr->value() : "0");
     124        addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));
    125125        addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
    126126        addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
Note: See TracChangeset for help on using the changeset viewer.