Changeset 171014 in webkit


Ignore:
Timestamp:
Jul 11, 2014 3:36:14 PM (10 years ago)
Author:
Alan Bujtas
Message:

REGRESSION (r168868): eBay 'see all' links fail due to different JS bindings conversion behavior.
https://bugs.webkit.org/show_bug.cgi?id=134841
<rdar://problem/17577563>

Reviewed by Simon Fraser.

Revert back to type int for Element.scroll* APIs in order to preserve exception handling
behavior.

Source/WebCore:
Test: cssom/non-subpixel-scroll-top-left-values.html

  • dom/Element.cpp:

(WebCore::Element::scrollLeft):
(WebCore::Element::scrollTop):
(WebCore::Element::setScrollLeft):
(WebCore::Element::setScrollTop):
(WebCore::Element::scrollWidth):
(WebCore::Element::scrollHeight):

  • dom/Element.h:
  • dom/Element.idl:
  • html/HTMLBodyElement.cpp:

(WebCore::adjustForZoom):
(WebCore::HTMLBodyElement::scrollLeft):
(WebCore::HTMLBodyElement::setScrollLeft):
(WebCore::HTMLBodyElement::scrollTop):
(WebCore::HTMLBodyElement::setScrollTop):
(WebCore::HTMLBodyElement::scrollHeight):
(WebCore::HTMLBodyElement::scrollWidth):

  • html/HTMLBodyElement.h:

LayoutTests:

  • cssom/non-subpixel-scroll-top-left-values-expected.txt: Added.
  • cssom/non-subpixel-scroll-top-left-values.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r171010 r171014  
     12014-07-11  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r168868): eBay 'see all' links fail due to different JS bindings conversion behavior.
     4        https://bugs.webkit.org/show_bug.cgi?id=134841
     5        <rdar://problem/17577563>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Revert back to type int for Element.scroll* APIs in order to preserve exception handling
     10        behavior.
     11
     12        * cssom/non-subpixel-scroll-top-left-values-expected.txt: Added.
     13        * cssom/non-subpixel-scroll-top-left-values.html: Added.
     14
    1152014-07-11  Javier Fernandez  <jfernandez@igalia.com>
    216
  • trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt

    r168868 r171014  
    2424PASS nonNumericPolicy('document.body.scrollByLines(x)') is 'any type allowed'
    2525PASS nonNumericPolicy('document.body.scrollByPages(x)') is 'any type allowed'
    26 PASS nonNumericPolicy('document.body.scrollLeft = x') is 'mixed'
    27 PASS nonNumericPolicy('document.body.scrollTop = x') is 'mixed'
     26PASS nonNumericPolicy('document.body.scrollLeft = x') is 'any type allowed'
     27PASS nonNumericPolicy('document.body.scrollTop = x') is 'any type allowed'
    2828PASS nonNumericPolicy('document.images.item(x)') is 'any type allowed'
    2929PASS nonNumericPolicy('document.createElement("input").setSelectionRange(x, 0)') is 'any type allowed'
  • trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js

    r168868 r171014  
    227227shouldBe("nonNumericPolicy('document.body.scrollByLines(x)')", "'any type allowed'");
    228228shouldBe("nonNumericPolicy('document.body.scrollByPages(x)')", "'any type allowed'");
    229 shouldBe("nonNumericPolicy('document.body.scrollLeft = x')", "'mixed'");
    230 shouldBe("nonNumericPolicy('document.body.scrollTop = x')", "'mixed'");
     229shouldBe("nonNumericPolicy('document.body.scrollLeft = x')", "'any type allowed'");
     230shouldBe("nonNumericPolicy('document.body.scrollTop = x')", "'any type allowed'");
    231231
    232232// History
     
    393393../../../../WebCore/html/HTMLAreaElement.idl:        attribute long tabIndex;
    394394../../../../WebCore/html/HTMLBaseFontElement.idl:        attribute long size;
    395 ../../../../WebCore/html/HTMLBodyElement.idl:                 attribute float scrollLeft;
    396 ../../../../WebCore/html/HTMLBodyElement.idl:                 attribute float scrollTop;
     395../../../../WebCore/html/HTMLBodyElement.idl:                 attribute long scrollLeft;
     396../../../../WebCore/html/HTMLBodyElement.idl:                 attribute long scrollTop;
    397397../../../../WebCore/html/HTMLButtonElement.idl:                 attribute  long                 tabIndex;
    398398../../../../WebCore/html/HTMLCanvasElement.idl:        attribute long width;
  • trunk/Source/WebCore/ChangeLog

    r171013 r171014  
     12014-07-11  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r168868): eBay 'see all' links fail due to different JS bindings conversion behavior.
     4        https://bugs.webkit.org/show_bug.cgi?id=134841
     5        <rdar://problem/17577563>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Revert back to type int for Element.scroll* APIs in order to preserve exception handling
     10        behavior.
     11
     12        Test: cssom/non-subpixel-scroll-top-left-values.html
     13
     14        * dom/Element.cpp:
     15        (WebCore::Element::scrollLeft):
     16        (WebCore::Element::scrollTop):
     17        (WebCore::Element::setScrollLeft):
     18        (WebCore::Element::setScrollTop):
     19        (WebCore::Element::scrollWidth):
     20        (WebCore::Element::scrollHeight):
     21        * dom/Element.h:
     22        * dom/Element.idl:
     23        * html/HTMLBodyElement.cpp:
     24        (WebCore::adjustForZoom):
     25        (WebCore::HTMLBodyElement::scrollLeft):
     26        (WebCore::HTMLBodyElement::setScrollLeft):
     27        (WebCore::HTMLBodyElement::scrollTop):
     28        (WebCore::HTMLBodyElement::setScrollTop):
     29        (WebCore::HTMLBodyElement::scrollHeight):
     30        (WebCore::HTMLBodyElement::scrollWidth):
     31        * html/HTMLBodyElement.h:
     32
    1332014-07-11  Joseph Pecoraro  <pecoraro@apple.com>
    234
  • trunk/Source/WebCore/dom/Element.cpp

    r171001 r171014  
    824824}
    825825
    826 double Element::scrollLeft()
     826int Element::scrollLeft()
    827827{
    828828    document().updateLayoutIgnorePendingStylesheets();
     
    833833}
    834834
    835 double Element::scrollTop()
     835int Element::scrollTop()
    836836{
    837837    document().updateLayoutIgnorePendingStylesheets();
     
    842842}
    843843
    844 void Element::setScrollLeft(double newLeft)
     844void Element::setScrollLeft(int newLeft)
    845845{
    846846    document().updateLayoutIgnorePendingStylesheets();
    847847
    848848    if (RenderBox* renderer = renderBox()) {
    849         renderer->setScrollLeft(round(newLeft * renderer->style().effectiveZoom()));
     849        renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()));
    850850        if (auto* scrollableArea = renderer->layer())
    851851            scrollableArea->setScrolledProgrammatically(true);
     
    853853}
    854854
    855 void Element::setScrollTop(double newTop)
     855void Element::setScrollTop(int newTop)
    856856{
    857857    document().updateLayoutIgnorePendingStylesheets();
    858858
    859859    if (RenderBox* renderer = renderBox()) {
    860         renderer->setScrollTop(round(newTop * renderer->style().effectiveZoom()));
     860        renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()));
    861861        if (auto* scrollableArea = renderer->layer())
    862862            scrollableArea->setScrolledProgrammatically(true);
     
    864864}
    865865
    866 double Element::scrollWidth()
     866int Element::scrollWidth()
    867867{
    868868    document().updateLayoutIgnorePendingStylesheets();
     
    872872}
    873873
    874 double Element::scrollHeight()
     874int Element::scrollHeight()
    875875{
    876876    document().updateLayoutIgnorePendingStylesheets();
  • trunk/Source/WebCore/dom/Element.h

    r170585 r171014  
    221221    double clientWidth();
    222222    double clientHeight();
    223     virtual double scrollLeft();
    224     virtual double scrollTop();
    225     virtual void setScrollLeft(double);
    226     virtual void setScrollTop(double);
    227     virtual double scrollWidth();
    228     virtual double scrollHeight();
     223    virtual int scrollLeft();
     224    virtual int scrollTop();
     225    virtual void setScrollLeft(int);
     226    virtual void setScrollTop(int);
     227    virtual int scrollWidth();
     228    virtual int scrollHeight();
    229229
    230230    IntRect boundsInRootViewSpace();
  • trunk/Source/WebCore/dom/Element.idl

    r170585 r171014  
    7979    readonly attribute long clientWidth;
    8080    readonly attribute long clientHeight;
    81     attribute long scrollLeft;
    82     attribute long scrollTop;
    83     readonly attribute long scrollWidth;
    84     readonly attribute long scrollHeight;
    8581#else
    8682    readonly attribute double offsetLeft;
     
    9288    readonly attribute double clientWidth;
    9389    readonly attribute double clientHeight;
    94     attribute double scrollLeft;
    95     attribute double scrollTop;
    96     readonly attribute double scrollWidth;
    97     readonly attribute double scrollHeight;
    98 #endif
     90#endif
     91
     92    attribute long scrollLeft;
     93    attribute long scrollTop;
     94    readonly attribute long scrollWidth;
     95    readonly attribute long scrollHeight;
    9996
    10097    [ImplementedAs=bindingsOffsetParent] readonly attribute Element offsetParent;
  • trunk/Source/WebCore/html/HTMLBodyElement.cpp

    r170774 r171014  
    199199}
    200200
    201 static double adjustForZoom(int value, const Frame& frame)
     201static int adjustForZoom(int value, const Frame& frame)
    202202{
    203203    double zoomFactor = frame.pageZoomFactor() * frame.frameScaleFactor();
     
    207207    if (zoomFactor > 1)
    208208        value++;
    209     return value / zoomFactor;
    210 }
    211 
    212 double HTMLBodyElement::scrollLeft()
    213 {
    214     document().updateLayoutIgnorePendingStylesheets();
    215     Frame* frame = document().frame();
    216     if (!frame)
    217         return 0;
    218     FrameView* view = frame->view();
    219     if (!view)
    220         return 0;
    221     return floor(adjustForZoom(view->contentsScrollPosition().x(), *frame));
    222 }
    223 
    224 void HTMLBodyElement::setScrollLeft(double scrollLeft)
     209    return static_cast<int>(value / zoomFactor);
     210}
     211
     212int HTMLBodyElement::scrollLeft()
     213{
     214    document().updateLayoutIgnorePendingStylesheets();
     215    Frame* frame = document().frame();
     216    if (!frame)
     217        return 0;
     218    FrameView* view = frame->view();
     219    if (!view)
     220        return 0;
     221    return adjustForZoom(view->contentsScrollPosition().x(), *frame);
     222}
     223
     224void HTMLBodyElement::setScrollLeft(int scrollLeft)
    225225{
    226226    document().updateLayoutIgnorePendingStylesheets();
     
    234234}
    235235
    236 double HTMLBodyElement::scrollTop()
    237 {
    238     document().updateLayoutIgnorePendingStylesheets();
    239     Frame* frame = document().frame();
    240     if (!frame)
    241         return 0;
    242     FrameView* view = frame->view();
    243     if (!view)
    244         return 0;
    245     return floor(adjustForZoom(view->contentsScrollPosition().y(), *frame));
    246 }
    247 
    248 void HTMLBodyElement::setScrollTop(double scrollTop)
     236int HTMLBodyElement::scrollTop()
     237{
     238    document().updateLayoutIgnorePendingStylesheets();
     239    Frame* frame = document().frame();
     240    if (!frame)
     241        return 0;
     242    FrameView* view = frame->view();
     243    if (!view)
     244        return 0;
     245    return adjustForZoom(view->contentsScrollPosition().y(), *frame);
     246}
     247
     248void HTMLBodyElement::setScrollTop(int scrollTop)
    249249{
    250250    document().updateLayoutIgnorePendingStylesheets();
     
    258258}
    259259
    260 double HTMLBodyElement::scrollHeight()
     260int HTMLBodyElement::scrollHeight()
    261261{
    262262    // Update the document's layout.
     
    268268    if (!view)
    269269        return 0;
    270     return floor(adjustForZoom(view->contentsHeight(), *frame));
    271 }
    272 
    273 double HTMLBodyElement::scrollWidth()
     270    return adjustForZoom(view->contentsHeight(), *frame);
     271}
     272
     273int HTMLBodyElement::scrollWidth()
    274274{
    275275    // Update the document's layout.
     
    281281    if (!view)
    282282        return 0;
    283     return floor(adjustForZoom(view->contentsWidth(), *frame));
     283    return adjustForZoom(view->contentsWidth(), *frame);
    284284}
    285285
  • trunk/Source/WebCore/html/HTMLBodyElement.h

    r168868 r171014  
    7070    virtual bool supportsFocus() const override;
    7171
    72     virtual double scrollLeft() override;
    73     virtual void setScrollLeft(double) override;
     72    virtual int scrollLeft() override;
     73    virtual void setScrollLeft(int) override;
    7474   
    75     virtual double scrollTop() override;
    76     virtual void setScrollTop(double) override;
     75    virtual int scrollTop() override;
     76    virtual void setScrollTop(int) override;
    7777   
    78     virtual double scrollHeight() override;
    79     virtual double scrollWidth() override;
     78    virtual int scrollHeight() override;
     79    virtual int scrollWidth() override;
    8080   
    8181    virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
Note: See TracChangeset for help on using the changeset viewer.