Remove overflow: scroll handling in block flow layout methods
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2012 03:38:53 +0000 (03:38 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2012 03:38:53 +0000 (03:38 +0000)
commit18bd07909bdb571c7eaf148e2581bd55f7f9a416
treebce91a96a8f94750ba5eb458407f25c6d25c0cd0
parent269855847eccd693a5f0b780bb5454dd342bd39a
Remove overflow: scroll handling in block flow layout methods
https://bugs.webkit.org/show_bug.cgi?id=92689

Reviewed by Simon Fraser.

The overflow: scroll scrollbars creation was done at layout time for all RenderBlocks and
descendants. This was not only wrong ('overflow' only changes at style change time) but it
was also introducing some code duplication.

The gist of this change is to share the code by moving it to RenderLayer::updateScrollbarsAfterStyleChange,
this includes the code from bug 69993 to special case list box part.

Covered by existing tests:
- All fast/overflow ones.
- For the list box change:
    fast/forms/select-overflow-scroll-inherited.html
    fast/forms/select-overflow-scroll.html
- For the flexbox:
    css3/flexbox/preferred-widths-orthogonal.html
    css3/flexbox/preferred-widths.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
Removed the common code here.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computePreferredLogicalWidths):
Changed to an ASSERT now that the right scrollbars are created. This is
fine as overflow-x/y are physical coordinates and our access was following that.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::invalidateScrollbarRect):
Added an early return here if we are not attached yet as RenderLayer::styleChanged
is called at attachment time before we are inserted in the tree. This is fine as the
scrollbars are part of the object which will be painted after the first layout.

(WebCore::overflowRequiresAScrollbar):
(WebCore::overflowDefinesAutomaticScrollbar):
Split the logic in those 2 functions.

(WebCore::RenderLayer::updateScrollbarsAfterLayout):
Updated to use the require / can-have functions. Also added
an early return for list box parts as required by bug 69993.

(WebCore::RenderLayer::updateScrollbarsAfterStyleChange):
Added an early return for list box parts as required by bug 69993,
also removed some unneeded NULL-checks that were added for list box parts.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124168 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderLayer.cpp