Changeset 93627 in webkit
- Timestamp:
- Aug 23, 2011 12:44:43 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r93626 r93627 1 2011-08-23 Alexandru Chiculita <achicu@adobe.com> 2 3 [CSSRegions] RenderFlowThread layout should use the attached region sizes 4 https://bugs.webkit.org/show_bug.cgi?id=66143 5 6 Reviewed by David Hyatt. 7 8 * fast/regions/webkit-flow-floats-inside-regions-bounds-expected.txt: Added. 9 * fast/regions/webkit-flow-floats-inside-regions-bounds.html: Added. 10 * fast/regions/webkit-flow-inlines-inside-regions-bounds-expected.txt: Added. 11 * fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical-expected.txt: Added. 12 * fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical-rl-expected.txt: Added. 13 * fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical-rl.html: Added. 14 * fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical.html: Added. 15 * fast/regions/webkit-flow-inlines-inside-regions-bounds.html: Added. 16 1 17 2011-08-23 Alexandru Chiculita <achicu@adobe.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r93626 r93627 1 2011-08-23 Alexandru Chiculita <achicu@adobe.com> 2 3 [CSSRegions] RenderFlowThread layout should use the attached region sizes 4 https://bugs.webkit.org/show_bug.cgi?id=66143 5 6 When RenderFlowThread is doing the layout it also sets the current RenderFlowThread on 7 the RenderView. RenderFlowThread cannot be nested inside a single RenderView, so there's no 8 need to put that on the LayoutState. 9 10 The right offset used to layout the inlines inside a RenderFlowThread 11 is now adjusted to fit inside the current region. 12 13 Reviewed by David Hyatt. 14 15 Tests: fast/regions/webkit-flow-floats-inside-regions-bounds.html 16 fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical-rl.html 17 fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical.html 18 fast/regions/webkit-flow-inlines-inside-regions-bounds.html 19 20 * rendering/LayoutState.cpp: 21 (WebCore::LayoutState::LayoutState): 22 * rendering/RenderBlock.cpp: 23 (WebCore::RenderBlock::layoutBlock): 24 (WebCore::RenderBlock::adjustForRegionFittingIfNeeded): 25 (WebCore::RenderBlock::logicalRightOffsetForLine): 26 * rendering/RenderBlock.h: 27 * rendering/RenderFlowThread.cpp: 28 (WebCore::RenderFlowThread::RenderFlowThread): 29 (WebCore::CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer): 30 (WebCore::CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer): 31 (WebCore::RenderFlowThread::layout): 32 (WebCore::RenderFlowThread::renderRegionForLine): 33 (WebCore::RenderFlowThread::regionLogicalWidthForLine): 34 * rendering/RenderFlowThread.h: 35 (WebCore::RegionFittingDisabler::RegionFittingDisabler): 36 (WebCore::RegionFittingDisabler::~RegionFittingDisabler): 37 * rendering/RenderRegion.cpp: 38 (WebCore::RenderRegion::layout): 39 * rendering/RenderRegion.h: 40 * rendering/RenderView.cpp: 41 (WebCore::RenderView::RenderView): 42 * rendering/RenderView.h: 43 (WebCore::RenderView::hasRenderFlowThread): 44 (WebCore::RenderView::currentRenderFlowThread): 45 (WebCore::RenderView::setCurrentRenderFlowThread): 46 (WebCore::RenderView::pushLayoutState): 47 1 48 2011-08-23 Alexandru Chiculita <achicu@adobe.com> 2 49 -
trunk/Source/WebCore/rendering/LayoutState.cpp
r93556 r93627 83 83 // If we establish a new page height, then cache the offset to the top of the first page. 84 84 // We can compare this later on to figure out what part of the page we're actually on, 85 if (pageLogicalHeight || m_columnInfo ) {85 if (pageLogicalHeight || m_columnInfo || renderer->isRenderFlowThread()) { 86 86 m_pageLogicalHeight = pageLogicalHeight; 87 87 m_pageOffset = LayoutSize(m_layoutOffset.width() + renderer->borderLeft() + renderer->paddingLeft(), -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r93626 r93627 42 42 #include "RenderCombineText.h" 43 43 #include "RenderDeprecatedFlexibleBox.h" 44 #include "RenderFlowThread.h" 44 45 #include "RenderImage.h" 45 46 #include "RenderInline.h" … … 1223 1224 } 1224 1225 1225 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); 1226 RenderView* renderView = view(); 1227 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); 1228 1229 bool disableRegionFitting = renderView->hasRenderFlowThread() && (hasColumns() || (isPositioned() && !isRenderFlowThread()) || isFloating()); 1230 RegionFittingDisabler regionFittingDisabler(renderView->currentRenderFlowThread(), disableRegionFitting); 1226 1231 1227 1232 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track … … 1306 1311 statePusher.pop(); 1307 1312 1308 if ( view()->layoutState()->m_pageLogicalHeight)1309 setPageLogicalOffset( view()->layoutState()->pageLogicalOffset(logicalTop()));1313 if (renderView->layoutState()->m_pageLogicalHeight) 1314 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(logicalTop())); 1310 1315 1311 1316 updateLayerTransform(); … … 3561 3566 } 3562 3567 3568 void RenderBlock::adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const 3569 { 3570 RenderView* renderView = view(); 3571 if (!renderView->hasRenderFlowThread()) 3572 return; 3573 3574 RenderFlowThread* flowThread = renderView->currentRenderFlowThread(); 3575 if (!flowThread->isRegionFittingEnabled() || !flowThread->hasValidRegions()) 3576 return; 3577 3578 LayoutState* layoutState = renderView->layoutState(); 3579 IntSize delta = layoutState->m_layoutOffset - layoutState->m_pageOffset; 3580 int offset = isHorizontalWritingMode() ? delta.height() : delta.width(); 3581 LayoutUnit regionWidth = flowThread->regionLogicalWidthForLine(offset + logicalTop); 3582 rightOffset -= flowThread->logicalWidth() - regionWidth; 3583 } 3584 3563 3585 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const 3564 3586 { 3565 3587 LayoutUnit right = fixedOffset; 3588 adjustForRegionFittingIfNeeded(logicalTop, right); 3566 3589 3567 3590 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { … … 3569 3592 *heightRemaining = 1; 3570 3593 3571 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, right, heightRemaining); 3594 LayoutUnit rightFloatOffset = fixedOffset; 3595 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, rightFloatOffset, heightRemaining); 3572 3596 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 3597 right = min(right, rightFloatOffset); 3573 3598 } 3574 3599 -
trunk/Source/WebCore/rendering/RenderBlock.h
r93626 r93627 313 313 virtual void paintObject(PaintInfo&, const LayoutPoint&); 314 314 315 void adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const; 316 315 317 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, LayoutUnit* logicalHeightRemaining = 0) const; 316 318 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, LayoutUnit* logicalHeightRemaining = 0) const; -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r93556 r93627 45 45 : RenderBlock(node) 46 46 , m_flowThread(flowThread) 47 , m_hasValidRegions(false) 47 48 , m_regionsInvalidated(false) 49 , m_regionFittingDisableCount(0) 48 50 { 49 51 setIsAnonymous(false); … … 271 273 } 272 274 275 class CurrentRenderFlowThreadMaintainer { 276 WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); 277 public: 278 CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) 279 : m_renderFlowThread(renderFlowThread) 280 { 281 RenderView* view = m_renderFlowThread->view(); 282 ASSERT(!view->currentRenderFlowThread()); 283 view->setCurrentRenderFlowThread(m_renderFlowThread); 284 } 285 ~CurrentRenderFlowThreadMaintainer() 286 { 287 RenderView* view = m_renderFlowThread->view(); 288 ASSERT(view->currentRenderFlowThread() == m_renderFlowThread); 289 view->setCurrentRenderFlowThread(0); 290 } 291 private: 292 RenderFlowThread* m_renderFlowThread; 293 }; 294 273 295 void RenderFlowThread::layout() 274 296 { 297 CurrentRenderFlowThreadMaintainer currentFlowThreadSetter(this); 298 275 299 if (m_regionsInvalidated) { 276 300 m_regionsInvalidated = false; … … 284 308 285 309 ASSERT(!region->needsLayout()); 310 311 m_hasValidRegions = true; 286 312 287 313 IntRect regionRect; … … 437 463 } 438 464 465 RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position, bool extendLastRegion) const 466 { 467 ASSERT(!m_regionsInvalidated); 468 469 // All the regions should start at 0. 470 ASSERT(position >= 0); 471 472 // If no region matches the position and extendLastRegion is true, it will return 473 // the last valid region. It is similar to auto extending the size of the last region. 474 RenderRegion* lastValidRegion = 0; 475 476 // FIXME: The regions are always in order, optimize this search. 477 bool useHorizontalWritingMode = isHorizontalWritingMode(); 478 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 479 RenderRegion* region = *iter; 480 if (!region->isValid()) 481 continue; 482 483 LayoutRect regionRect = region->regionRect(); 484 485 if (useHorizontalWritingMode) { 486 if (regionRect.y() <= position && position < regionRect.maxY()) 487 return region; 488 continue; 489 } 490 491 if (regionRect.x() <= position && position < regionRect.maxX()) 492 return region; 493 494 if (extendLastRegion) 495 lastValidRegion = region; 496 } 497 498 return lastValidRegion; 499 } 500 501 LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position) const 502 { 503 const bool extendLastRegion = true; 504 RenderRegion* region = renderRegionForLine(position, extendLastRegion); 505 if (!region) 506 return 0; 507 508 return isHorizontalWritingMode() ? region->regionRect().width() : region->regionRect().height(); 509 } 510 511 439 512 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r93556 r93627 86 86 87 87 bool hasRegions() const { return m_regionList.size(); } 88 bool hasValidRegions() const { ASSERT(!m_regionsInvalidated); return m_hasValidRegions; } 88 89 89 90 void invalidateRegions() { m_regionsInvalidated = true; setNeedsLayout(true); } … … 97 98 void repaintRectangleInRegions(const LayoutRect&, bool immediate); 98 99 100 LayoutUnit regionLogicalWidthForLine(LayoutUnit position) const; 101 102 bool isRegionFittingEnabled() const { return !m_regionFittingDisableCount; } 103 void disableRegionFitting() { m_regionFittingDisableCount++; } 104 void enableRegionFitting() { ASSERT(m_regionFittingDisableCount > 0); m_regionFittingDisableCount--; } 105 99 106 private: 100 107 virtual const char* renderName() const { return "RenderFlowThread"; } 108 109 RenderRegion* renderRegionForLine(LayoutUnit position, bool extendLastRegion = false) const; 101 110 102 111 bool dependsOn(RenderFlowThread* otherRenderFlowThread) const; … … 123 132 RenderFlowThreadCountedSet m_layoutBeforeThreadsSet; 124 133 134 bool m_hasValidRegions; 125 135 bool m_regionsInvalidated; 136 unsigned m_regionFittingDisableCount; 126 137 }; 127 138 … … 141 152 void toRenderFlowThread(const RenderFlowThread*); 142 153 154 class RegionFittingDisabler { 155 WTF_MAKE_NONCOPYABLE(RegionFittingDisabler); 156 public: 157 RegionFittingDisabler(RenderFlowThread* flowThread, bool disable) 158 { 159 if (flowThread && disable) { 160 m_flowThread = flowThread; 161 m_flowThread->disableRegionFitting(); 162 } else 163 m_flowThread = 0; 164 } 165 166 ~RegionFittingDisabler() 167 { 168 if (m_flowThread) 169 m_flowThread->enableRegionFitting(); 170 } 171 private: 172 RenderFlowThread* m_flowThread; 173 }; 174 175 143 176 } // namespace WebCore 144 177 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r93556 r93627 83 83 } 84 84 85 void RenderRegion::layout() 86 { 87 RenderReplaced::layout(); 88 if (m_flowThread && isValid()) 89 m_flowThread->invalidateRegions(); 90 } 91 85 92 void RenderRegion::attachRegion() 86 93 { -
trunk/Source/WebCore/rendering/RenderRegion.h
r93556 r93627 59 59 void setIsValid(bool valid) { m_isValid = valid; } 60 60 61 virtual void layout(); 62 61 63 private: 62 64 virtual const char* renderName() const { return "RenderRegion"; } -
trunk/Source/WebCore/rendering/RenderView.cpp
r93556 r93627 56 56 , m_layoutState(0) 57 57 , m_layoutStateDisableCount(0) 58 , m_currentRenderFlowThread(0) 58 59 { 59 60 // Clear our anonymous bit, set because RenderObject assumes -
trunk/Source/WebCore/rendering/RenderView.h
r93556 r93627 182 182 const RenderFlowThreadList* renderFlowThreadList() const { return m_renderFlowThreadList.get(); } 183 183 184 bool hasRenderFlowThread() const { return m_currentRenderFlowThread; } 185 RenderFlowThread* currentRenderFlowThread() const { return m_currentRenderFlowThread; } 186 void setCurrentRenderFlowThread(RenderFlowThread* flowThread) { m_currentRenderFlowThread = flowThread; } 187 184 188 void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 185 189 … … 197 201 { 198 202 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. 199 if (!doingFullRepaint() || renderer->hasColumns() || m_layoutState->isPaginated() ) {203 if (!doingFullRepaint() || renderer->hasColumns() || m_layoutState->isPaginated() || hasRenderFlowThread()) { 200 204 m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, pageHeightChanged, colInfo); 201 205 return true; … … 266 270 #endif 267 271 OwnPtr<RenderFlowThreadList> m_renderFlowThreadList; 272 RenderFlowThread* m_currentRenderFlowThread; 268 273 }; 269 274
Note: See TracChangeset
for help on using the changeset viewer.