⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 194404 in webkit


Ignore:
Timestamp:
Dec 23, 2015, 4:34:59 PM (11 years ago)
Author:
Simon Fraser
Message:

Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
https://bugs.webkit.org/show_bug.cgi?id=152515

Reviewed by Tim Horton.

Source/WebCore:

Remove the scrollsOverflow() check in RenderBox::canBeProgramaticallyScrolled(),
since if hasScrollableOverflow is true, scrollsOverflow() must also be true.

Factor clientWidth/Height vs. scrollWidth/Height checks into separate functions,
and call them from two places.

Added a test which is not affected by this particular change, but will verify
that a later change doesn't break anything.

Test: fast/overflow/overflow-hidden-scroll-into-view.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::canBeScrolledAndHasScrollableArea):
(WebCore::RenderBox::canBeProgramaticallyScrolled):

  • rendering/RenderBox.h:

(WebCore::RenderBox::hasHorizontalOverflow):
(WebCore::RenderBox::hasVerticalOverflow):
(WebCore::RenderBox::hasScrollableOverflowX):
(WebCore::RenderBox::hasScrollableOverflowY):

LayoutTests:

Test that programmatic scrolling works inside overflow:hidden.

  • fast/overflow/overflow-hidden-scroll-into-view-expected.html: Added.
  • fast/overflow/overflow-hidden-scroll-into-view.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r194403 r194404  
     12015-12-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
     4        https://bugs.webkit.org/show_bug.cgi?id=152515
     5
     6        Reviewed by Tim Horton.
     7
     8        Test that programmatic scrolling works inside overflow:hidden.
     9
     10        * fast/overflow/overflow-hidden-scroll-into-view-expected.html: Added.
     11        * fast/overflow/overflow-hidden-scroll-into-view.html: Added.
     12
    1132015-12-23  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r194399 r194404  
     12015-12-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
     4        https://bugs.webkit.org/show_bug.cgi?id=152515
     5
     6        Reviewed by Tim Horton.
     7
     8        Remove the scrollsOverflow() check in RenderBox::canBeProgramaticallyScrolled(),
     9        since if hasScrollableOverflow is true, scrollsOverflow() must also be true.
     10       
     11        Factor clientWidth/Height vs. scrollWidth/Height checks into separate functions,
     12        and call them from two places.
     13       
     14        Added a test which is not affected by this particular change, but will verify
     15        that a later change doesn't break anything.
     16
     17        Test: fast/overflow/overflow-hidden-scroll-into-view.html
     18
     19        * rendering/RenderBox.cpp:
     20        (WebCore::RenderBox::canBeScrolledAndHasScrollableArea):
     21        (WebCore::RenderBox::canBeProgramaticallyScrolled):
     22        * rendering/RenderBox.h:
     23        (WebCore::RenderBox::hasHorizontalOverflow):
     24        (WebCore::RenderBox::hasVerticalOverflow):
     25        (WebCore::RenderBox::hasScrollableOverflowX):
     26        (WebCore::RenderBox::hasScrollableOverflowY):
     27
    1282015-12-23  Pranjal Jumde  <pjumde@apple.com>
    229
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r194030 r194404  
    868868bool RenderBox::canBeScrolledAndHasScrollableArea() const
    869869{
    870     return canBeProgramaticallyScrolled() && (scrollHeight() != roundToInt(clientHeight()) || scrollWidth() != roundToInt(clientWidth()));
     870    return canBeProgramaticallyScrolled() && (hasHorizontalOverflow() || hasVerticalOverflow());
    871871}
    872872
     
    884884        return false;
    885885
    886     bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverflowY();
    887     if (scrollsOverflow() && hasScrollableOverflow)
     886    if (hasScrollableOverflowX() || hasScrollableOverflowY())
    888887        return true;
    889888
  • trunk/Source/WebCore/rendering/RenderBox.h

    r192413 r194404  
    470470    bool hasVerticalScrollbarWithAutoBehavior() const;
    471471    bool hasHorizontalScrollbarWithAutoBehavior() const;
     472
    472473    bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
    473474    bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == OSCROLL || hasHorizontalScrollbarWithAutoBehavior()); }
    474475    bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == OSCROLL || hasVerticalScrollbarWithAutoBehavior()); }
    475     bool hasScrollableOverflowX() const { return scrollsOverflowX() && scrollWidth() != roundToInt(clientWidth()); }
    476     bool hasScrollableOverflowY() const { return scrollsOverflowY() && scrollHeight() != roundToInt(clientHeight()); }
     476
     477    bool hasHorizontalOverflow() const { return scrollWidth() != roundToInt(clientWidth()); }
     478    bool hasVerticalOverflow() const { return scrollHeight() != roundToInt(clientHeight()); }
     479
     480    bool hasScrollableOverflowX() const { return scrollsOverflowX() && hasHorizontalOverflow(); }
     481    bool hasScrollableOverflowY() const { return scrollsOverflowY() && hasVerticalOverflow(); }
    477482
    478483    bool usesCompositedScrolling() const;
Note: See TracChangeset for help on using the changeset viewer.