Changeset 124168 in webkit
- Timestamp:
- Jul 30, 2012 8:38:53 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r124162 r124168 1 2012-07-30 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Remove overflow: scroll handling in block flow layout methods 4 https://bugs.webkit.org/show_bug.cgi?id=92689 5 6 Reviewed by Simon Fraser. 7 8 The overflow: scroll scrollbars creation was done at layout time for all RenderBlocks and 9 descendants. This was not only wrong ('overflow' only changes at style change time) but it 10 was also introducing some code duplication. 11 12 The gist of this change is to share the code by moving it to RenderLayer::updateScrollbarsAfterStyleChange, 13 this includes the code from bug 69993 to special case list box part. 14 15 Covered by existing tests: 16 - All fast/overflow ones. 17 - For the list box change: 18 fast/forms/select-overflow-scroll-inherited.html 19 fast/forms/select-overflow-scroll.html 20 - For the flexbox: 21 css3/flexbox/preferred-widths-orthogonal.html 22 css3/flexbox/preferred-widths.html 23 24 * rendering/RenderBlock.cpp: 25 (WebCore::RenderBlock::layoutBlock): 26 * rendering/RenderDeprecatedFlexibleBox.cpp: 27 (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): 28 * rendering/RenderGrid.cpp: 29 (WebCore::RenderGrid::layoutBlock): 30 * rendering/RenderFlexibleBox.cpp: 31 (WebCore::RenderFlexibleBox::layoutBlock): 32 Removed the common code here. 33 34 * rendering/RenderFlexibleBox.cpp: 35 (WebCore::RenderFlexibleBox::computePreferredLogicalWidths): 36 Changed to an ASSERT now that the right scrollbars are created. This is 37 fine as overflow-x/y are physical coordinates and our access was following that. 38 39 * rendering/RenderLayer.cpp: 40 (WebCore::RenderLayer::invalidateScrollbarRect): 41 Added an early return here if we are not attached yet as RenderLayer::styleChanged 42 is called at attachment time before we are inserted in the tree. This is fine as the 43 scrollbars are part of the object which will be painted after the first layout. 44 45 (WebCore::overflowRequiresAScrollbar): 46 (WebCore::overflowDefinesAutomaticScrollbar): 47 Split the logic in those 2 functions. 48 49 (WebCore::RenderLayer::updateScrollbarsAfterLayout): 50 Updated to use the require / can-have functions. Also added 51 an early return for list box parts as required by bug 69993. 52 53 (WebCore::RenderLayer::updateScrollbarsAfterStyleChange): 54 Added an early return for list box parts as required by bug 69993, 55 also removed some unneeded NULL-checks that were added for list box parts. 56 1 57 2012-07-30 Vivek Galatage <vivekgalatage@gmail.com> 2 58 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r123988 r124168 1473 1473 } 1474 1474 1475 // For overflow:scroll blocks, ensure we have both scrollbars in place always.1476 if (scrollsOverflow() && style()->appearance() != ListboxPart) {1477 if (styleToUse->overflowX() == OSCROLL)1478 layer()->setHasHorizontalScrollbar(true);1479 if (styleToUse->overflowY() == OSCROLL)1480 layer()->setHasVerticalScrollbar(true);1481 }1482 1483 1475 LayoutUnit repaintLogicalTop = ZERO_LAYOUT_UNIT; 1484 1476 LayoutUnit repaintLogicalBottom = ZERO_LAYOUT_UNIT; -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r122264 r124168 263 263 initMaxMarginValues(); 264 264 265 // For overflow:scroll blocks, ensure we have both scrollbars in place always.266 if (scrollsOverflow()) {267 if (style()->overflowX() == OSCROLL)268 layer()->setHasHorizontalScrollbar(true);269 if (style()->overflowY() == OSCROLL)270 layer()->setHasVerticalScrollbar(true);271 }272 273 265 if (isHorizontal()) 274 266 layoutHorizontalBox(relayoutChildren); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r123909 r124168 195 195 if (hasOverflowClip()) { 196 196 if (isHorizontalWritingMode() && styleToUse->overflowY() == OSCROLL) { 197 layer()->setHasVerticalScrollbar(true);197 ASSERT(layer()->hasVerticalScrollbar()); 198 198 scrollbarWidth = verticalScrollbarWidth(); 199 199 } else if (!isHorizontalWritingMode() && styleToUse->overflowX() == OSCROLL) { 200 layer()->setHasHorizontalScrollbar(true);200 ASSERT(layer()->hasHorizontalScrollbar()); 201 201 scrollbarWidth = horizontalScrollbarHeight(); 202 202 } … … 248 248 249 249 m_overflow.clear(); 250 251 // For overflow:scroll blocks, ensure we have both scrollbars in place always.252 if (scrollsOverflow()) {253 if (style()->overflowX() == OSCROLL)254 layer()->setHasHorizontalScrollbar(true);255 if (style()->overflowY() == OSCROLL)256 layer()->setHasVerticalScrollbar(true);257 }258 250 259 251 WTF::Vector<LineContext> lineContexts; -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r122747 r124168 80 80 81 81 m_overflow.clear(); 82 83 if (scrollsOverflow()) {84 if (style()->overflowX() == OSCROLL)85 layer()->setHasHorizontalScrollbar(true);86 if (style()->overflowY() == OSCROLL)87 layer()->setHasVerticalScrollbar(true);88 }89 82 90 83 layoutGridItems(); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r123990 r124168 2230 2230 RenderBox* box = renderBox(); 2231 2231 ASSERT(box); 2232 // If we are not yet inserted into the tree, there is no need to repaint. 2233 if (!box->parent()) 2234 return; 2235 2232 2236 if (scrollbar == m_vBar.get()) 2233 2237 scrollRect.move(verticalScrollbarStart(0, box->width()), box->borderTop()); … … 2523 2527 ASSERT(box); 2524 2528 2529 // List box parts handle the scrollbars by themselves so we have nothing to do. 2530 if (box->style()->appearance() == ListboxPart) 2531 return; 2532 2525 2533 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); 2526 2534 bool hasVerticalOverflow = this->hasVerticalOverflow(); 2527 2535 2528 2536 // overflow:scroll should just enable/disable. 2529 if ( m_hBar &&renderer()->style()->overflowX() == OSCROLL)2537 if (renderer()->style()->overflowX() == OSCROLL) 2530 2538 m_hBar->setEnabled(hasHorizontalOverflow); 2531 if ( m_vBar &&renderer()->style()->overflowY() == OSCROLL)2539 if (renderer()->style()->overflowY() == OSCROLL) 2532 2540 m_vBar->setEnabled(hasVerticalOverflow); 2533 2541 … … 4819 4827 } 4820 4828 4821 static bool overflowCanHaveAScrollbar(EOverflow overflow) 4822 { 4823 return overflow == OAUTO || overflow == OSCROLL || overflow == OOVERLAY; 4829 static bool overflowRequiresScrollbar(EOverflow overflow) 4830 { 4831 return overflow == OSCROLL; 4832 } 4833 4834 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) 4835 { 4836 return overflow == OAUTO || overflow == OOVERLAY; 4824 4837 } 4825 4838 … … 4827 4840 { 4828 4841 // Overflow are a box concept. 4829 if (!renderBox()) 4830 return; 4831 4832 EOverflow overflowX = renderBox()->style()->overflowX(); 4833 EOverflow overflowY = renderBox()->style()->overflowY(); 4834 if (hasHorizontalScrollbar() && !overflowCanHaveAScrollbar(overflowX)) 4835 setHasHorizontalScrollbar(false); 4836 if (hasVerticalScrollbar() && !overflowCanHaveAScrollbar(overflowY)) 4837 setHasVerticalScrollbar(false); 4842 RenderBox* box = renderBox(); 4843 if (!box) 4844 return; 4845 4846 // List box parts handle the scrollbars by themselves so we have nothing to do. 4847 if (box->style()->appearance() == ListboxPart) 4848 return; 4849 4850 EOverflow overflowX = box->style()->overflowX(); 4851 EOverflow overflowY = box->style()->overflowY(); 4852 4853 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present. 4854 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefinesAutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); 4855 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAutomaticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); 4856 setHasHorizontalScrollbar(needsHorizontalScrollbar); 4857 setHasVerticalScrollbar(needsVerticalScrollbar); 4838 4858 4839 4859 // With overflow: scroll, scrollbars are always visible but may be disabled. 4840 4860 // When switching to another value, we need to re-enable them (see bug 11985). 4841 if ( hasHorizontalScrollbar()&& oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) {4842 ASSERT( overflowCanHaveAScrollbar(overflowX));4861 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) { 4862 ASSERT(hasHorizontalScrollbar()); 4843 4863 m_hBar->setEnabled(true); 4844 4864 } 4845 4865 4846 if ( hasVerticalScrollbar()&& oldStyle->overflowY() == OSCROLL && overflowY != OSCROLL) {4847 ASSERT( overflowCanHaveAScrollbar(overflowY));4866 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL && overflowY != OSCROLL) { 4867 ASSERT(hasVerticalScrollbar()); 4848 4868 m_vBar->setEnabled(true); 4849 4869 }
Note: See TracChangeset
for help on using the changeset viewer.