Changeset 87277 in webkit
- Timestamp:
- May 25, 2011 12:17:21 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87276 r87277 1 2011-05-25 Yuzo Fujishima <yuzo@google.com> 2 3 Reviewed by Kent Tamura. 4 5 Fix for Bug 61352 - Refactor RenderView::{enable,disable}LayoutState call sites to use RIIA 6 https://bugs.webkit.org/show_bug.cgi?id=61352 7 8 No new tests because no behavior changes. 9 10 * html/shadow/MediaControlElements.cpp: 11 (WebCore::RenderMediaVolumeSliderContainer::layout): 12 * page/FrameView.cpp: 13 (WebCore::FrameView::layout): 14 * rendering/RenderBlock.cpp: 15 (WebCore::RenderBlock::repaintOverhangingFloats): 16 (WebCore::RenderBlock::updateFirstLetter): 17 * rendering/RenderLayer.cpp: 18 (WebCore::RenderLayer::updateLayerPositions): 19 (WebCore::RenderLayer::updateScrollInfoAfterLayout): 20 * rendering/RenderListBox.cpp: 21 (WebCore::RenderListBox::layout): 22 * rendering/RenderListItem.cpp: 23 (WebCore::RenderListItem::updateMarkerLocation): 24 * rendering/RenderMedia.cpp: 25 (WebCore::RenderMedia::layout): 26 * rendering/RenderView.h: 27 (WebCore::RenderView::disableLayoutState): 28 (WebCore::RenderView::enableLayoutState): 29 (WebCore::LayoutStateDisabler::LayoutStateDisabler): 30 (WebCore::LayoutStateDisabler::~LayoutStateDisabler): 31 * rendering/svg/RenderSVGRoot.cpp: 32 (WebCore::RenderSVGRoot::layout): 33 1 34 2011-05-24 Csaba Osztrogonác <ossy@webkit.org> 2 35 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r84336 r87277 168 168 RenderBox* buttonBox = toRenderBox(previousSibling()); 169 169 170 if (view()) 171 view()->disableLayoutState(); 170 LayoutStateDisabler layoutStateDisabler(view()); 172 171 173 172 IntPoint offset = theme()->volumeSliderOffsetFromMuteButton(buttonBox, IntSize(width(), height())); 174 173 setX(offset.x() + buttonBox->offsetLeft()); 175 174 setY(offset.y() + buttonBox->offsetTop()); 176 177 if (view())178 view()->enableLayoutState();179 175 } 180 176 -
trunk/Source/WebCore/page/FrameView.cpp
r87187 r87277 979 979 m_actionScheduler->pause(); 980 980 981 bool disableLayoutState = false; 982 if (subtree) { 983 RenderView* view = root->view(); 984 disableLayoutState = view->shouldDisableLayoutStateForSubtree(root); 985 view->pushLayoutState(root); 986 if (disableLayoutState) 987 view->disableLayoutState(); 988 } 989 990 m_inLayout = true; 991 beginDeferredRepaints(); 992 root->layout(); 993 endDeferredRepaints(); 994 m_inLayout = false; 995 996 if (subtree) { 997 RenderView* view = root->view(); 998 view->popLayoutState(root); 999 if (disableLayoutState) 1000 view->enableLayoutState(); 981 { 982 bool disableLayoutState = false; 983 if (subtree) { 984 RenderView* view = root->view(); 985 disableLayoutState = view->shouldDisableLayoutStateForSubtree(root); 986 view->pushLayoutState(root); 987 } 988 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? root->view() : 0); 989 990 m_inLayout = true; 991 beginDeferredRepaints(); 992 root->layout(); 993 endDeferredRepaints(); 994 m_inLayout = false; 995 996 if (subtree) 997 root->view()->popLayoutState(root); 1001 998 } 1002 999 m_layoutRoot = 0; -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r87152 r87277 2226 2226 // FIXME: Avoid disabling LayoutState. At the very least, don't disable it for floats originating 2227 2227 // in this block. Better yet would be to push extra state for the containers of other floats. 2228 view()->disableLayoutState();2228 LayoutStateDisabler layoutStateDisabler(view()); 2229 2229 FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2230 2230 FloatingObjectSetIterator end = floatingObjectSet.end(); … … 2239 2239 } 2240 2240 } 2241 view()->enableLayoutState();2242 2241 } 2243 2242 … … 5352 5351 5353 5352 // Move the first letter into the new renderer. 5354 view()->disableLayoutState();5353 LayoutStateDisabler layoutStateDisabler(view()); 5355 5354 while (RenderObject* child = firstLetter->firstChild()) { 5356 5355 if (child->isText()) … … 5359 5358 newFirstLetter->addChild(child, 0); 5360 5359 } 5361 5360 5362 5361 RenderTextFragment* remainingText = 0; 5363 5362 RenderObject* nextSibling = firstLetter->nextSibling(); … … 5378 5377 firstLetter = newFirstLetter; 5379 5378 firstLetterContainer->addChild(firstLetter, nextSibling); 5380 view()->enableLayoutState();5381 5379 } else 5382 5380 firstLetter->setStyle(pseudoStyle); … … 5398 5396 // Our layout state is not valid for the repaints we are going to trigger by 5399 5397 // adding and removing children of firstLetterContainer. 5400 view()->disableLayoutState();5398 LayoutStateDisabler layoutStateDisabler(view()); 5401 5399 5402 5400 RenderText* textObj = toRenderText(currChild); … … 5461 5459 textObj->destroy(); 5462 5460 } 5463 view()->enableLayoutState();5464 5461 } 5465 5462 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r86584 r87277 310 310 RenderView* view = renderer()->view(); 311 311 ASSERT(view); 312 // FIXME: Optimize using LayoutState and remove the disableLayoutState() call312 // FIXME: Optimize using LayoutState and remove LayoutStateDisabler instantiation 313 313 // from updateScrollInfoAfterLayout(). 314 314 ASSERT(!view->layoutStateEnabled()); … … 2182 2182 // scrollToOffset() may call updateLayerPositions(), which doesn't work 2183 2183 // with LayoutState. 2184 // FIXME: Remove the disableLayoutState/enableLayoutState if the above changes. 2185 if (view) 2186 view->disableLayoutState(); 2184 // FIXME: Remove the LayoutStateDisabler instantiation if the above changes. 2185 LayoutStateDisabler layoutStateDisabler(view); 2187 2186 scrollToOffset(newX, newY); 2188 if (view)2189 view->enableLayoutState();2190 2187 } 2191 2188 } … … 2262 2259 2263 2260 RenderView* view = renderer()->view(); 2264 view->disableLayoutState(); 2265 scrollToOffset(scrollXOffset(), scrollYOffset()); 2266 view->enableLayoutState(); 2267 2261 { 2262 LayoutStateDisabler layoutStateDisabler(view); 2263 scrollToOffset(scrollXOffset(), scrollYOffset()); 2264 } 2265 2268 2266 if (renderer()->node() && renderer()->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) 2269 2267 updateOverflowStatus(horizontalOverflow, verticalOverflow); -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r87152 r87277 151 151 RenderBlock::layout(); 152 152 if (m_scrollToRevealSelectionAfterLayout) { 153 view()->disableLayoutState();153 LayoutStateDisabler layoutStateDisabler(view()); 154 154 scrollToRevealSelection(); 155 view()->enableLayoutState();156 155 } 157 156 } -
trunk/Source/WebCore/rendering/RenderListItem.cpp
r82611 r87277 214 214 // Removing and adding the marker can trigger repainting in 215 215 // containers other than ourselves, so we need to disable LayoutState. 216 view()->disableLayoutState();216 LayoutStateDisabler layoutStateDisabler(view()); 217 217 updateFirstLetter(); 218 218 m_marker->remove(); … … 222 222 if (m_marker->preferredLogicalWidthsDirty()) 223 223 m_marker->computePreferredLogicalWidths(); 224 view()->enableLayoutState();225 224 } 226 225 } -
trunk/Source/WebCore/rendering/RenderMedia.cpp
r86395 r87277 71 71 72 72 // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or 73 // call view()->disableLayoutState().Since using a LayoutStateMaintainer is slightly more efficient,73 // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient, 74 74 // and this method will be called many times per second during playback, use a LayoutStateMaintainer: 75 75 LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); -
trunk/Source/WebCore/rendering/RenderView.h
r86632 r87277 126 126 LayoutState* layoutState() const { return m_layoutState; } 127 127 128 // Suspends the LayoutState optimization. Used under transforms that cannot be represented by129 // LayoutState (common in SVG) and when manipulating the render tree during layout in ways130 // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around).131 // Note that even when disabled, LayoutState is still used to store layoutDelta.132 void disableLayoutState() { m_layoutStateDisableCount++; }133 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; }134 135 128 virtual void updateHitTestResult(HitTestResult&, const IntPoint&); 136 129 … … 196 189 } 197 190 191 // Suspends the LayoutState optimization. Used under transforms that cannot be represented by 192 // LayoutState (common in SVG) and when manipulating the render tree during layout in ways 193 // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around). 194 // Note that even when disabled, LayoutState is still used to store layoutDelta. 195 // These functions may only be accessed by LayoutStateMaintainer or LayoutStateDisabler. 196 void disableLayoutState() { m_layoutStateDisableCount++; } 197 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; } 198 198 199 size_t getRetainedWidgets(Vector<RenderWidget*>&); 199 200 void releaseWidgets(Vector<RenderWidget*>&); 200 201 201 202 friend class LayoutStateMaintainer; 203 friend class LayoutStateDisabler; 202 204 203 205 protected: … … 322 324 }; 323 325 326 class LayoutStateDisabler { 327 WTF_MAKE_NONCOPYABLE(LayoutStateDisabler); 328 public: 329 LayoutStateDisabler(RenderView* view) 330 : m_view(view) 331 { 332 if (m_view) 333 m_view->disableLayoutState(); 334 } 335 336 ~LayoutStateDisabler() 337 { 338 if (m_view) 339 m_view->enableLayoutState(); 340 } 341 private: 342 RenderView* m_view; 343 }; 344 324 345 } // namespace WebCore 325 346 -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r87027 r87277 104 104 105 105 // Arbitrary affine transforms are incompatible with LayoutState. 106 view()->disableLayoutState();106 LayoutStateDisabler layoutStateDisabler(view()); 107 107 108 108 bool needsLayout = selfNeedsLayout(); … … 129 129 repainter.repaintAfterLayout(); 130 130 131 view()->enableLayoutState();132 131 setNeedsLayout(false); 133 132 }
Note: See TracChangeset
for help on using the changeset viewer.