Changeset 147082 in webkit
- Timestamp:
- Mar 28, 2013 1:26:28 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147076 r147082 1 2013-03-28 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSSRegions] Consolidate use of RenderRegion::isValid 4 https://bugs.webkit.org/show_bug.cgi?id=113154 5 6 Reviewed by David Hyatt. 7 8 After https://bugs.webkit.org/show_bug.cgi?id=98752, the list of invalid regions is kept separately than the list of valid regions. 9 A valid region has always a valid flow thread attached. We can use isValid() throughout the RenderRegion code 10 instead of testing for both isValid() and m_flowThread. 11 12 No new tests since there is no change is functionality, just code refactoring. 13 14 * rendering/RenderNamedFlowThread.cpp: 15 (WebCore::RenderNamedFlowThread::addRegionToNamedFlowThread): Added a new function to keep the code 16 used in addRegionToThread and checkInvalidRegions. 17 (WebCore::RenderNamedFlowThread::addRegionToThread): 18 (WebCore::RenderNamedFlowThread::checkInvalidRegions): 19 * rendering/RenderNamedFlowThread.h: 20 * rendering/RenderRegion.cpp: 21 (WebCore::RenderRegion::overflowRectForFlowThreadPortion): 22 (WebCore::RenderRegion::isFirstRegion): 23 (WebCore::RenderRegion::isLastRegion): 24 (WebCore::RenderRegion::paintObject): 25 (WebCore::RenderRegion::nodeAtPoint): 26 (WebCore::RenderRegion::incrementAutoLogicalHeightCount): 27 (WebCore::RenderRegion::decrementAutoLogicalHeightCount): 28 (WebCore::RenderRegion::layoutBlock): 29 (WebCore::RenderRegion::repaintFlowThreadContentRectangle): 30 (WebCore::RenderRegion::attachRegion): 31 (WebCore::RenderRegion::renderBoxRegionInfo): 32 (WebCore::RenderRegion::setRenderBoxRegionInfo): 33 (WebCore::RenderRegion::logicalTopOfFlowThreadContentRect): 34 (WebCore::RenderRegion::logicalBottomOfFlowThreadContentRect): 35 (WebCore::RenderRegion::computePreferredLogicalWidths): 36 1 37 2013-03-27 Ilya Tikhonovsky <loislo@chromium.org> 2 38 -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp
r143322 r147082 223 223 } 224 224 225 void RenderNamedFlowThread::addRegionTo Thread(RenderRegion* renderRegion)225 void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegion) 226 226 { 227 227 ASSERT(renderRegion); 228 229 resetMarkForDestruction();230 231 228 ASSERT(!renderRegion->isValid()); 232 if (renderRegion->parentNamedFlowThread()) { 233 if (renderRegion->parentNamedFlowThread()->dependsOn(this)) { 234 // The order of invalid regions is irrelevant. 235 m_invalidRegionList.add(renderRegion); 236 // Register ourself to get a notification when the state changes. 237 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.add(this); 238 return; 239 } 240 229 230 if (renderRegion->parentNamedFlowThread()) 241 231 addDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); 242 }243 232 244 233 renderRegion->setIsValid(true); 245 234 addRegionToList(m_regionList, renderRegion); 235 } 236 237 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) 238 { 239 ASSERT(renderRegion); 240 ASSERT(!renderRegion->isValid()); 241 242 resetMarkForDestruction(); 243 244 if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowThread()->dependsOn(this)) { 245 // The order of invalid regions is irrelevant. 246 m_invalidRegionList.add(renderRegion); 247 // Register ourself to get a notification when the state changes. 248 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.add(this); 249 return; 250 } 251 252 addRegionToNamedFlowThread(renderRegion); 246 253 247 254 invalidateRegions(); … … 294 301 m_invalidRegionList.remove(region); 295 302 region->parentNamedFlowThread()->m_observerThreadsSet.remove(this); 296 region->setIsValid(true); 297 addDependencyOnFlowThread(region->parentNamedFlowThread()); 298 addRegionToList(m_regionList, region); 303 addRegionToNamedFlowThread(region); 299 304 } 300 305 -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.h
r140640 r147082 88 88 void addDependencyOnFlowThread(RenderNamedFlowThread*); 89 89 void removeDependencyOnFlowThread(RenderNamedFlowThread*); 90 91 void addRegionToNamedFlowThread(RenderRegion*); 92 90 93 void checkInvalidRegions(); 94 91 95 bool canBeDestroyed() const { return m_invalidRegionList.isEmpty() && m_regionList.isEmpty() && m_contentNodes.isEmpty(); } 92 96 void regionLayoutUpdateEventTimerFired(Timer<RenderNamedFlowThread>*); -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r145596 r147082 92 92 LayoutRect RenderRegion::overflowRectForFlowThreadPortion(LayoutRect flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const 93 93 { 94 ASSERT(isValid()); 95 94 96 // FIXME: Would like to just use hasOverflowClip() but we aren't a block yet. When RenderRegion is eliminated and 95 97 // folded into RenderBlock, switch to hasOverflowClip(). … … 97 99 bool clipY = style()->overflowY() != OVISIBLE; 98 100 bool isLastRegionWithRegionOverflowBreak = (isLastPortion && (style()->regionOverflow() == BreakRegionOverflow)); 99 if ((clipX && clipY) || !isValid() || !m_flowThread ||isLastRegionWithRegionOverflowBreak)101 if ((clipX && clipY) || isLastRegionWithRegionOverflowBreak) 100 102 return flowThreadPortionRect; 101 103 … … 129 131 bool RenderRegion::isFirstRegion() const 130 132 { 131 ASSERT(isValid() && m_flowThread); 133 ASSERT(isValid()); 134 132 135 return m_flowThread->firstRegion() == this; 133 136 } … … 135 138 bool RenderRegion::isLastRegion() const 136 139 { 137 ASSERT(isValid() && m_flowThread); 140 ASSERT(isValid()); 141 138 142 return m_flowThread->lastRegion() == this; 139 143 } … … 150 154 // Since we do not want to paint the flow thread content multiple times (for each painting phase of the region object), 151 155 // we allow the flow thread painting only for the selection and the foreground phase. 152 if (! m_flowThread || !isValid() || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))156 if (!isValid() || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 153 157 return; 154 158 … … 173 177 if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) { 174 178 // Check the contents of the RenderFlowThread. 175 if (m_flowThread && m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))179 if (m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop()))) 176 180 return true; 177 181 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); … … 199 203 void RenderRegion::incrementAutoLogicalHeightCount() 200 204 { 201 ASSERT(m_flowThread);202 205 ASSERT(isValid()); 203 206 ASSERT(m_hasAutoLogicalHeight); … … 208 211 void RenderRegion::decrementAutoLogicalHeightCount() 209 212 { 210 ASSERT(m_flowThread);211 213 ASSERT(isValid()); 212 214 … … 261 263 RenderBlock::layoutBlock(relayoutChildren); 262 264 263 if ( m_flowThread &&isValid()) {265 if (isValid()) { 264 266 LayoutRect oldRegionRect(flowThreadPortionRect()); 265 267 if (!isHorizontalWritingMode()) … … 295 297 void RenderRegion::repaintFlowThreadContentRectangle(const LayoutRect& repaintRect, bool immediate, const LayoutRect& flowThreadPortionRect, const LayoutRect& flowThreadPortionOverflowRect, const LayoutPoint& regionLocation) const 296 298 { 299 ASSERT(isValid()); 300 297 301 // We only have to issue a repaint in this region if the region rect intersects the repaint rect. 298 302 LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect); … … 355 359 return; 356 360 361 // Only after adding the region to the thread, the region is marked to be valid. 357 362 m_flowThread->addRegionToThread(this); 358 363 … … 381 386 RenderBoxRegionInfo* RenderRegion::renderBoxRegionInfo(const RenderBox* box) const 382 387 { 383 if (!m_isValid || !m_flowThread) 384 return 0; 388 ASSERT(isValid()); 385 389 return m_renderBoxRegionInfo.get(box); 386 390 } … … 389 393 bool containingBlockChainIsInset) 390 394 { 391 ASSERT(m_isValid && m_flowThread); 392 if (!m_isValid || !m_flowThread) 393 return 0; 395 ASSERT(isValid()); 394 396 395 397 OwnPtr<RenderBoxRegionInfo>& boxInfo = m_renderBoxRegionInfo.add(box, nullptr).iterator->value; … … 419 421 LayoutUnit RenderRegion::logicalTopOfFlowThreadContentRect(const LayoutRect& rect) const 420 422 { 421 if (!m_isValid || !flowThread()) 422 return 0; 423 ASSERT(isValid()); 423 424 return flowThread()->isHorizontalWritingMode() ? rect.y() : rect.x(); 424 425 } … … 426 427 LayoutUnit RenderRegion::logicalBottomOfFlowThreadContentRect(const LayoutRect& rect) const 427 428 { 428 if (!m_isValid || !flowThread()) 429 return 0; 429 ASSERT(isValid()); 430 430 return flowThread()->isHorizontalWritingMode() ? rect.maxY() : rect.maxX(); 431 431 } … … 591 591 { 592 592 ASSERT(preferredLogicalWidthsDirty()); 593 if (!m_flowThread || !m_isValid) { 593 594 if (!isValid()) { 594 595 RenderBlock::computePreferredLogicalWidths(); 595 596 return;
Note: See TracChangeset
for help on using the changeset viewer.