Changeset 93538 in webkit
- Timestamp:
- Aug 22, 2011 2:04:33 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r93536 r93538 1 2011-08-22 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-lr-expected.txt: Added. 12 * fast/regions/webkit-flow-inlines-inside-regions-bounds-vertical-lr.html: Added. 13 * fast/regions/webkit-flow-inlines-inside-regions-bounds.html: Added. 14 1 15 2011-08-22 David Levin <levin@chromium.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r93532 r93538 1 2011-08-22 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-lr.html 17 fast/regions/webkit-flow-inlines-inside-regions-bounds.html 18 19 * rendering/LayoutState.cpp: 20 (WebCore::LayoutState::LayoutState): 21 * rendering/RenderBlock.cpp: 22 (WebCore::RenderBlock::layoutBlock): 23 (WebCore::RenderBlock::adjustForRegionFittingIfNeeded): 24 (WebCore::RenderBlock::logicalRightOffsetForLine): 25 * rendering/RenderBlock.h: 26 * rendering/RenderFlowThread.cpp: 27 (WebCore::RenderFlowThread::RenderFlowThread): 28 (WebCore::CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer): 29 (WebCore::CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer): 30 (WebCore::RenderFlowThread::layout): 31 (WebCore::RenderFlowThread::renderRegionForLine): 32 (WebCore::RenderFlowThread::regionLogicalWidthForLine): 33 * rendering/RenderFlowThread.h: 34 (WebCore::RegionFittingDisabler::RegionFittingDisabler): 35 (WebCore::RegionFittingDisabler::~RegionFittingDisabler): 36 * rendering/RenderRegion.cpp: 37 (WebCore::RenderRegion::layout): 38 * rendering/RenderRegion.h: 39 * rendering/RenderView.cpp: 40 (WebCore::RenderView::RenderView): 41 * rendering/RenderView.h: 42 (WebCore::RenderView::hasRenderFlowThread): 43 (WebCore::RenderView::currentRenderFlowThread): 44 (WebCore::RenderView::setCurrentRenderFlowThread): 45 (WebCore::RenderView::pushLayoutState): 46 1 47 2011-08-22 Peter Kasting <pkasting@google.com> 2 48 -
trunk/Source/WebCore/rendering/LayoutState.cpp
r89945 r93538 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
r93436 r93538 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(); … … 3557 3562 } 3558 3563 3564 void RenderBlock::adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const 3565 { 3566 RenderView* renderView = view(); 3567 if (!renderView->hasRenderFlowThread()) 3568 return; 3569 3570 RenderFlowThread* flowThread = renderView->currentRenderFlowThread(); 3571 if (!flowThread->isRegionFittingEnabled()) 3572 return; 3573 3574 LayoutState* layoutState = renderView->layoutState(); 3575 IntSize delta = layoutState->m_layoutOffset - layoutState->m_pageOffset; 3576 int offset = isHorizontalWritingMode() ? delta.height() : delta.width(); 3577 LayoutUnit regionWidth = flowThread->regionLogicalWidthForLine(offset + logicalTop); 3578 rightOffset -= flowThread->logicalWidth() - regionWidth; 3579 } 3580 3559 3581 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const 3560 3582 { 3561 3583 LayoutUnit right = fixedOffset; 3584 adjustForRegionFittingIfNeeded(logicalTop, right); 3562 3585 3563 3586 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { … … 3565 3588 *heightRemaining = 1; 3566 3589 3567 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, right, heightRemaining); 3590 LayoutUnit rightFloatOffset = fixedOffset; 3591 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, rightFloatOffset, heightRemaining); 3568 3592 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 3593 right = min(right, rightFloatOffset); 3569 3594 } 3570 3595 -
trunk/Source/WebCore/rendering/RenderBlock.h
r93436 r93538 312 312 virtual void paintObject(PaintInfo&, const LayoutPoint&); 313 313 314 void adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const; 315 314 316 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, LayoutUnit* logicalHeightRemaining = 0) const; 315 317 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, LayoutUnit* logicalHeightRemaining = 0) const; -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r93432 r93538 46 46 , m_flowThread(flowThread) 47 47 , m_regionsInvalidated(false) 48 , m_regionFittingDisableCount(0) 48 49 { 49 50 setIsAnonymous(false); … … 271 272 } 272 273 274 class CurrentRenderFlowThreadMaintainer { 275 WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); 276 public: 277 CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) 278 : m_renderFlowThread(renderFlowThread) 279 { 280 RenderView* view = m_renderFlowThread->view(); 281 ASSERT(!view->currentRenderFlowThread()); 282 view->setCurrentRenderFlowThread(m_renderFlowThread); 283 } 284 ~CurrentRenderFlowThreadMaintainer() 285 { 286 RenderView* view = m_renderFlowThread->view(); 287 ASSERT(view->currentRenderFlowThread() == m_renderFlowThread); 288 view->setCurrentRenderFlowThread(0); 289 } 290 private: 291 RenderFlowThread* m_renderFlowThread; 292 }; 293 273 294 void RenderFlowThread::layout() 274 295 { 296 CurrentRenderFlowThreadMaintainer currentFlowThreadSetter(this); 297 275 298 if (m_regionsInvalidated) { 276 299 m_regionsInvalidated = false; … … 437 460 } 438 461 462 RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position) const 463 { 464 ASSERT(!m_regionsInvalidated); 465 466 // FIXME: The regions are always in order, optimize this search. 467 bool useHorizontalWritingMode = isHorizontalWritingMode(); 468 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 469 RenderRegion* region = *iter; 470 if (!region->isValid()) 471 continue; 472 473 LayoutRect regionRect = region->regionRect(); 474 475 if (useHorizontalWritingMode) { 476 if (regionRect.y() <= position && position < regionRect.maxY()) 477 return region; 478 continue; 479 } 480 481 if (regionRect.x() <= position && position < regionRect.maxX()) 482 return region; 483 } 484 485 return 0; 486 } 487 488 LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position) const 489 { 490 RenderRegion* region = renderRegionForLine(position); 491 if (!region) 492 return 0; 493 494 return isHorizontalWritingMode() ? region->regionRect().width() : region->regionRect().height(); 495 } 496 497 439 498 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r93432 r93538 97 97 void repaintRectangleInRegions(const LayoutRect&, bool immediate); 98 98 99 LayoutUnit regionLogicalWidthForLine(LayoutUnit position) const; 100 101 bool isRegionFittingEnabled() const { return !m_regionFittingDisableCount; } 102 void disableRegionFitting() { m_regionFittingDisableCount++; } 103 void enableRegionFitting() { ASSERT(m_regionFittingDisableCount > 0); m_regionFittingDisableCount--; } 104 99 105 private: 100 106 virtual const char* renderName() const { return "RenderFlowThread"; } 107 108 RenderRegion* renderRegionForLine(LayoutUnit position) const; 101 109 102 110 bool dependsOn(RenderFlowThread* otherRenderFlowThread) const; … … 124 132 125 133 bool m_regionsInvalidated; 134 unsigned m_regionFittingDisableCount; 126 135 }; 127 136 … … 141 150 void toRenderFlowThread(const RenderFlowThread*); 142 151 152 class RegionFittingDisabler { 153 WTF_MAKE_NONCOPYABLE(RegionFittingDisabler); 154 public: 155 RegionFittingDisabler(RenderFlowThread* flowThread, bool disable) 156 { 157 if (flowThread && disable) { 158 m_flowThread = flowThread; 159 m_flowThread->disableRegionFitting(); 160 } else 161 m_flowThread = 0; 162 } 163 164 ~RegionFittingDisabler() 165 { 166 if (m_flowThread) 167 m_flowThread->enableRegionFitting(); 168 } 169 private: 170 RenderFlowThread* m_flowThread; 171 }; 172 173 143 174 } // namespace WebCore 144 175 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r93307 r93538 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
r93307 r93538 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
r93307 r93538 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
r93307 r93538 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.