Changeset 161626 in webkit
- Timestamp:
- Jan 10, 2014 2:38:18 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r161623 r161626 1 2014-01-10 Andrei Bucur <abucur@adobe.com> 2 3 [CSS Regions] Implement visual overflow computation for inline elements 4 https://bugs.webkit.org/show_bug.cgi?id=125291 5 6 Reviewed by David Hyatt. 7 8 Tests for inline elements overflow correct painting inside regions. 9 10 * fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html: Added. 11 * fast/regions/overflow-in-variable-width-regions-inline-bt.html: Added. 12 * fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html: Added. 13 * fast/regions/overflow-in-variable-width-regions-inline-continuation.html: Added. 14 * fast/regions/overflow-in-variable-width-regions-inline-expected.html: Added. 15 * fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html: Added. 16 * fast/regions/overflow-in-variable-width-regions-inline-lr.html: Added. 17 * fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html: Added. 18 * fast/regions/overflow-in-variable-width-regions-inline-rl.html: Added. 19 * fast/regions/overflow-in-variable-width-regions-inline.html: Added. 20 1 21 2014-01-09 Jer Noble <jer.noble@apple.com> 2 22 -
trunk/Source/WebCore/ChangeLog
r161623 r161626 1 2014-01-10 Andrei Bucur <abucur@adobe.com> 2 3 [CSS Regions] Implement visual overflow computation for inline elements 4 https://bugs.webkit.org/show_bug.cgi?id=125291 5 6 Reviewed by David Hyatt. 7 8 The patch implements visual overflow computation for inline elements per region. The algorithm 9 uses the container region of each root line box to determine the lines in a region generated by 10 a RenderInline. The overflow of a RenderInline inside a region is the smallest rectangle that fits 11 all the line boxes belonging to that region. 12 13 The patch also correctly flips for writing mode the overflow of a renderer before clipping with it. 14 15 Tests: fast/regions/overflow-in-variable-width-regions-inline-bt.html 16 fast/regions/overflow-in-variable-width-regions-inline-continuation.html 17 fast/regions/overflow-in-variable-width-regions-inline-lr.html 18 fast/regions/overflow-in-variable-width-regions-inline-rl.html 19 fast/regions/overflow-in-variable-width-regions-inline.html 20 21 * rendering/RenderFlowThread.cpp: 22 (WebCore::RenderFlowThread::objectShouldPaintInFlowRegion): 23 * rendering/RenderInline.cpp: 24 (WebCore::RenderInline::updateAlwaysCreateLineBoxes): Always create line boxes for RenderInline 25 (WebCore::RenderInline::linesVisualOverflowBoundingBoxInRegion): 26 * rendering/RenderInline.h: 27 * rendering/RenderLayer.cpp: 28 (WebCore::RenderLayer::calculateClipRects): 29 * rendering/RenderRegion.cpp: 30 (WebCore::RenderRegion::visualOverflowRectForBox): 31 (WebCore::RenderRegion::visualOverflowRectForBoxForPropagation): 32 * rendering/RenderRegion.h: 33 1 34 2014-01-09 Jer Noble <jer.noble@apple.com> 2 35 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r161553 r161626 844 844 return false; 845 845 846 return object->isBox() ;846 return object->isBox() || object->isRenderInline(); 847 847 } 848 848 -
trunk/Source/WebCore/rendering/RenderInline.cpp
r161335 r161626 218 218 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(style().font().fontMetrics()) 219 219 || parentStyle->lineHeight() != style().lineHeight())) 220 || (flowThread && flowThread->isRenderNamedFlowThread() && toRenderNamedFlowThread(flowThread)->hasRegionsWithStyling());220 || (flowThread && flowThread->isRenderNamedFlowThread()); // FIXME: Enable the optimization once we make overflow computation for culled inlines in regions. 221 221 222 222 if (!alwaysCreateLineBoxes && checkFonts && document().styleSheetCollection().usesFirstLineRules()) { … … 1041 1041 } 1042 1042 1043 LayoutRect RenderInline::linesVisualOverflowBoundingBoxInRegion(const RenderRegion* region) const 1044 { 1045 ASSERT(alwaysCreateLineBoxes()); 1046 ASSERT(region); 1047 1048 if (!firstLineBox() || !lastLineBox()) 1049 return LayoutRect(); 1050 1051 // Return the width of the minimal left side and the maximal right side. 1052 LayoutUnit logicalLeftSide = LayoutUnit::max(); 1053 LayoutUnit logicalRightSide = LayoutUnit::min(); 1054 LayoutUnit logicalTop; 1055 LayoutUnit logicalHeight; 1056 InlineFlowBox* lastInlineInRegion = 0; 1057 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { 1058 const RootInlineBox& root = curr->root(); 1059 if (root.containingRegion() != region) { 1060 if (lastInlineInRegion) 1061 break; 1062 continue; 1063 } 1064 1065 if (!lastInlineInRegion) 1066 logicalTop = curr->logicalTopVisualOverflow(root.lineTop()); 1067 1068 lastInlineInRegion = curr; 1069 1070 logicalLeftSide = std::min(logicalLeftSide, curr->logicalLeftVisualOverflow()); 1071 logicalRightSide = std::max(logicalRightSide, curr->logicalRightVisualOverflow()); 1072 } 1073 1074 if (!lastInlineInRegion) 1075 return LayoutRect(); 1076 1077 logicalHeight = lastInlineInRegion->logicalBottomVisualOverflow(lastInlineInRegion->root().lineBottom()) - logicalTop; 1078 1079 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 1080 1081 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 1082 if (!style().isHorizontalWritingMode()) 1083 rect = rect.transposedRect(); 1084 return rect; 1085 } 1086 1043 1087 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const 1044 1088 { -
trunk/Source/WebCore/rendering/RenderInline.h
r161335 r161626 55 55 IntRect linesBoundingBox() const; 56 56 LayoutRect linesVisualOverflowBoundingBox() const; 57 LayoutRect linesVisualOverflowBoundingBoxInRegion(const RenderRegion*) const; 57 58 58 59 InlineFlowBox* createAndAppendInlineFlowBox(); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r161570 r161626 5500 5500 5501 5501 RenderFlowThread* flowThread = clipRectsContext.region ? clipRectsContext.region->flowThread() : 0; 5502 if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread() && renderBox()) {5503 // FIXME: Handle the case where the renderer is not a RenderBox.5504 LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region->visualOverflowRectForBox( renderBox());5502 if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread()) { 5503 const RenderBoxModelObject& boxModelObject = toRenderBoxModelObject(renderer()); 5504 LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region->visualOverflowRectForBox(&boxModelObject); 5505 5505 5506 5506 // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread. 5507 if ( flowThread->style().isFlippedBlocksWritingMode()) {5507 if (&boxModelObject == flowThread && flowThread->style().isFlippedBlocksWritingMode()) { 5508 5508 if (flowThread->style().isHorizontalWritingMode()) 5509 5509 layerBoundsWithVisualOverflow.moveBy(LayoutPoint(0, flowThread->height())); 5510 5510 else 5511 5511 layerBoundsWithVisualOverflow.moveBy(LayoutPoint(flowThread->width(), 0)); 5512 } else { 5513 RenderBlock* rendererContainingBlock = boxModelObject.enclosingBox()->isRenderBlock() ? toRenderBlock(boxModelObject.enclosingBox()) : 0; 5514 if (rendererContainingBlock) 5515 rendererContainingBlock->flipForWritingMode(layerBoundsWithVisualOverflow); 5512 5516 } 5513 5517 … … 5661 5665 // e.g. an absolutely positioned box with bottom:0px and right:0px would have it's frameRect.x relative 5662 5666 // to the flow thread, not the last region (in which it will end up because of bottom:0px) 5663 if (region && renderer(). isBox() && renderer().flowThreadContainingBlock()) {5667 if (region && renderer().flowThreadContainingBlock()) { 5664 5668 LayoutRect b = layerBounds; 5665 b.moveBy(region->visualOverflowRectForBox(toRenderBox (&renderer())).location());5669 b.moveBy(region->visualOverflowRectForBox(toRenderBoxModelObject(&renderer())).location()); 5666 5670 b.inflate(renderer().view().maximalOutlineSize()); 5667 5671 if (b.intersects(damageRect)) -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r161553 r161626 39 39 #include "Range.h" 40 40 #include "RenderBoxRegionInfo.h" 41 #include "RenderInline.h" 41 42 #include "RenderIterator.h" 42 43 #include "RenderLayer.h" … … 561 562 } 562 563 563 LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBox* box) 564 { 565 RefPtr<RenderOverflow> overflow; 566 ensureOverflowForBox(box, overflow, true); 567 568 ASSERT(overflow); 569 return overflow->visualOverflowRect(); 564 LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBoxModelObject* box) 565 { 566 if (box->isRenderInline()) { 567 const RenderInline* inlineBox = toRenderInline(box); 568 return inlineBox->linesVisualOverflowBoundingBoxInRegion(this); 569 } 570 571 if (box->isBox()) { 572 RefPtr<RenderOverflow> overflow; 573 ensureOverflowForBox(toRenderBox(box), overflow, true); 574 575 ASSERT(overflow); 576 return overflow->visualOverflowRect(); 577 } 578 579 ASSERT_NOT_REACHED(); 580 return LayoutRect(); 570 581 } 571 582 … … 591 602 } 592 603 593 LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBox * box)604 LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBoxModelObject* box) 594 605 { 595 606 LayoutRect rect = visualOverflowRectForBox(box); -
trunk/Source/WebCore/rendering/RenderRegion.h
r161553 r161626 121 121 void addVisualOverflowForBox(const RenderBox*, const LayoutRect&); 122 122 LayoutRect layoutOverflowRectForBox(const RenderBox*); 123 LayoutRect visualOverflowRectForBox(const RenderBox *);123 LayoutRect visualOverflowRectForBox(const RenderBoxModelObject*); 124 124 LayoutRect layoutOverflowRectForBoxForPropagation(const RenderBox*); 125 LayoutRect visualOverflowRectForBoxForPropagation(const RenderBox *);125 LayoutRect visualOverflowRectForBoxForPropagation(const RenderBoxModelObject*); 126 126 127 127 LayoutRect rectFlowPortionForBox(const RenderBox*, const LayoutRect&) const;
Note: See TracChangeset
for help on using the changeset viewer.