Changeset 142984 in webkit
- Timestamp:
- Feb 15, 2013 5:00:03 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142983 r142984 1 2013-02-15 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSS Regions] RenderRegion should inherit from RenderBlock 4 https://bugs.webkit.org/show_bug.cgi?id=74132 5 6 Reviewed by Julien Chaffraix. 7 8 Fix tests that were failing after the inheritance change. 9 10 * fast/regions/flows-dependency-dynamic-remove.html: As a block, an empty region can self collapse, 11 which was not possible for a replaced element. I used '-webkit-margin-collapse: separate' to prevent 12 margins self collapsing for body and avoid recreating the expectations. 13 I want regions margins to be able to self collapse, just like the other block elements. 14 * fast/regions/flows-dependency-same-flow.html: Ditto. 15 1 16 2013-02-15 Andrey Lushnikov <lushnikov@chromium.org> 2 17 -
trunk/LayoutTests/fast/regions/flows-dependency-dynamic-remove.html
r128155 r142984 2 2 3 3 <style> 4 body { -webkit-margin-collapse: separate; } 5 4 6 .flowA { -webkit-flow-into: flowA; } 5 7 .flowB { -webkit-flow-into: flowB; } -
trunk/LayoutTests/fast/regions/flows-dependency-same-flow.html
r128155 r142984 2 2 3 3 <style> 4 body { -webkit-margin-collapse: separate; } 5 4 6 .flowA { -webkit-flow-into: flowA; } 5 7 .flowB { -webkit-flow-into: flowB; } -
trunk/Source/WebCore/ChangeLog
r142983 r142984 1 2013-02-15 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSS Regions] RenderRegion should inherit from RenderBlock 4 https://bugs.webkit.org/show_bug.cgi?id=74132 5 6 Reviewed by Julien Chaffraix. 7 8 Change the base class for RenderRegion to be RenderBlock instead of RenderReplaced. 9 Per spec http://dev.w3.org/csswg/css3-regions/#the-flow-from-property, a region is a non-replaced block container. 10 This change is covered by the existing regions tests (in fast/region and fast/repaint). 11 12 The RenderFlowThread object is a self-painting layer (it requires layer and is positioned). 13 Because of that, the RenderFlowThread object is responsible for painting its children, 14 the collected objects. When the RenderRegion::paintObject is called during paint, it delegates painting 15 of content collected inside the flow thread to the associated RenderFlowThread object. 16 Since we do not want to paint the flow thread content multiple times (for each paint phase 17 in which the RenderRegion::paintObject is called), we allow RenderFlowThread painting only for 18 selection and foreground paint phases. 19 20 * rendering/RenderBox.cpp: Clean-up the code from regions specific stuff, now that the regions are render blocks. 21 (WebCore::RenderBox::computePositionedLogicalWidth): 22 (WebCore::RenderBox::computePositionedLogicalHeight): 23 * rendering/RenderLayerBacking.cpp: A region should always render content from its associated flow thread, 24 even when it does not have children of its own. 25 (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): 26 * rendering/RenderMultiColumnSet.cpp: Make changes to match the new inheritance for RenderRegion. 27 (WebCore::RenderMultiColumnSet::paint): 28 (WebCore::RenderMultiColumnSet::paintColumnRules): 29 * rendering/RenderMultiColumnSet.h: 30 * rendering/RenderRegion.cpp: 31 (WebCore::RenderRegion::RenderRegion): 32 (WebCore::RenderRegion::paintObject): 33 (WebCore::RenderRegion::styleDidChange): 34 (WebCore::RenderRegion::layoutBlock): 35 (WebCore::RenderRegion::insertedIntoTree): 36 (WebCore::RenderRegion::willBeRemovedFromTree): 37 (WebCore::RenderRegion::computePreferredLogicalWidths): Use this method instead of min/maxPreferredLogicalWidth. 38 (WebCore::RenderRegion::updateLogicalHeight): 39 * rendering/RenderRegion.h: For now, assume the region is not allowed to have children. 40 When we will implement the processing model for pseudo-elements http://dev.w3.org/csswg/css3-regions/#processing-model, 41 we will have to remove this function. By having this function return false i was able to leave some tests unchanged. 42 1 43 2013-02-15 Andrey Lushnikov <lushnikov@chromium.org> 2 44 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r142962 r142984 2926 2926 { 2927 2927 if (isReplaced()) { 2928 // FIXME: For regions with width auto, we want to compute width using the normal block sizing code. 2929 // For now, regions are replaced elements and this code can be removed once the RenderRegion 2930 // will inherit from RenderBlock instead of RenderReplaced. 2931 // (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 2932 if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) { 2933 computePositionedLogicalWidthReplaced(computedValues); // FIXME: Patch for regions when we add replaced element support. 2934 return; 2935 } 2928 // FIXME: Positioned replaced elements inside a flow thread are not working properly 2929 // with variable width regions (see https://bugs.webkit.org/show_bug.cgi?id=69896 ). 2930 computePositionedLogicalWidthReplaced(computedValues); 2931 return; 2936 2932 } 2937 2933 … … 3276 3272 { 3277 3273 if (isReplaced()) { 3278 // FIXME: For regions with height auto, we want to compute width using the normal block sizing code. 3279 // For now, regions are replaced elements and this code can be removed once the RenderRegion 3280 // will inherit from RenderBlock instead of RenderReplaced. 3281 // (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 3282 if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) { 3283 computePositionedLogicalHeightReplaced(computedValues); 3284 return; 3285 } 3274 computePositionedLogicalHeightReplaced(computedValues); 3275 return; 3286 3276 } 3287 3277 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r142815 r142984 1401 1401 if (paintsBoxDecorations() || paintsChildren()) 1402 1402 return false; 1403 1403 1404 if (renderObject->isRenderRegion()) 1405 return false; 1406 1404 1407 if (renderObject->node() && renderObject->node()->isDocumentNode()) { 1405 1408 // Look to see if the root object has a non-simple background -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r140244 r142984 29 29 #include "HitTestResult.h" 30 30 #include "PaintInfo.h" 31 #include "RenderMultiColumnBlock.h" 31 32 #include "RenderMultiColumnFlowThread.h" 32 #include "RenderMultiColumnBlock.h"33 33 34 34 using std::min; … … 206 206 } 207 207 208 void RenderMultiColumnSet::paint Replaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)208 void RenderMultiColumnSet::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 209 209 { 210 210 // FIXME: RenderRegions are replaced elements right now and so they only paint in the foreground phase. … … 259 259 currLogicalLeftOffset -= (inlineDirectionSize + colGap); 260 260 } 261 261 262 262 // Now paint the column rule. 263 263 if (i < colCount - 1) { -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.h
r140640 r142984 95 95 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; 96 96 97 virtual void paint Replaced(PaintInfo&, const LayoutPoint& paintOffset) OVERRIDE;97 virtual void paint(PaintInfo&, const LayoutPoint& paintOffset) OVERRIDE; 98 98 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; 99 99 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r140948 r142984 35 35 #include "HitTestResult.h" 36 36 #include "IntRect.h" 37 #include "LayoutRepainter.h" 37 38 #include "PaintInfo.h" 38 39 #include "Range.h" … … 45 46 46 47 RenderRegion::RenderRegion(Element* element, RenderFlowThread* flowThread) 47 : Render Replaced(element, IntSize())48 : RenderBlock(element) 48 49 , m_flowThread(flowThread) 49 50 , m_parentNamedFlowThread(0) … … 136 137 } 137 138 138 void RenderRegion::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 139 { 139 void RenderRegion::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 140 { 141 if (style()->visibility() != VISIBLE) 142 return; 143 144 RenderBlock::paintObject(paintInfo, paintOffset); 145 140 146 // Delegate painting of content in region to RenderFlowThread. 141 if (!m_flowThread || !isValid()) 147 // RenderFlowThread is a self painting layer (being a positioned object) who is painting its children, the collected objects. 148 // Since we do not want to paint the flow thread content multiple times (for each painting phase of the region object), 149 // we allow the flow thread painting only for the selection and the foreground phase. 150 if (!m_flowThread || !isValid() || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 142 151 return; 143 152 … … 224 233 void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 225 234 { 226 Render Replaced::styleDidChange(diff, oldStyle);235 RenderBlock::styleDidChange(diff, oldStyle); 227 236 228 237 // If the region is not attached to any thread, there is no need to check … … 238 247 } 239 248 240 void RenderRegion::layout ()249 void RenderRegion::layoutBlock(bool relayoutChildren, LayoutUnit) 241 250 { 242 251 StackStats::LayoutCheckPoint layoutCheckPoint; 243 RenderReplaced::layout(); 252 RenderBlock::layoutBlock(relayoutChildren); 253 244 254 if (m_flowThread && isValid()) { 245 255 LayoutRect oldRegionRect(flowThreadPortionRect()); … … 484 494 void RenderRegion::insertedIntoTree() 485 495 { 486 Render Replaced::insertedIntoTree();496 RenderBlock::insertedIntoTree(); 487 497 488 498 attachRegion(); … … 491 501 void RenderRegion::willBeRemovedFromTree() 492 502 { 493 Render Replaced::willBeRemovedFromTree();503 RenderBlock::willBeRemovedFromTree(); 494 504 495 505 detachRegion(); … … 571 581 } 572 582 573 // FIXME: when RenderRegion will inherit from RenderBlock instead of RenderReplaced, 574 // we should overwrite computePreferredLogicalWidths ( see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 575 LayoutUnit RenderRegion::minPreferredLogicalWidth() const 576 { 577 if (!m_flowThread || !m_isValid) 578 return RenderReplaced::minPreferredLogicalWidth(); 579 580 // FIXME: Currently, the code handles only the <length> case for min-width. It should also support other values, like percentage, calc 581 // or viewport relative. 583 void RenderRegion::computePreferredLogicalWidths() 584 { 585 ASSERT(preferredLogicalWidthsDirty()); 586 if (!m_flowThread || !m_isValid) { 587 RenderBlock::computePreferredLogicalWidths(); 588 return; 589 } 590 591 // FIXME: Currently, the code handles only the <length> case for min-width/max-width. 592 // It should also support other values, like percentage, calc or viewport relative. 593 m_minPreferredLogicalWidth = m_flowThread->minPreferredLogicalWidth(); 594 m_maxPreferredLogicalWidth = m_flowThread->maxPreferredLogicalWidth(); 595 582 596 RenderStyle* styleToUse = style(); 583 LayoutUnit minPreferredLogicalWidth = m_flowThread->minPreferredLogicalWidth(); 584 585 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) 586 minPreferredLogicalWidth = std::max(minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); 587 588 if (styleToUse->logicalMaxWidth().isFixed()) 589 minPreferredLogicalWidth = std::min(minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 590 591 return minPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 592 } 593 594 LayoutUnit RenderRegion::maxPreferredLogicalWidth() const 595 { 596 if (!m_flowThread || !m_isValid) 597 return RenderReplaced::maxPreferredLogicalWidth(); 598 599 // FIXME: Currently, the code handles only the <length> case for max-width. It should also support other values, like percentage, calc 600 // or viewport relative. 601 RenderStyle* styleToUse = style(); 602 LayoutUnit maxPreferredLogicalWidth = m_flowThread->maxPreferredLogicalWidth(); 603 604 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) 605 maxPreferredLogicalWidth = std::max(maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); 606 607 if (styleToUse->logicalMaxWidth().isFixed()) 608 maxPreferredLogicalWidth = std::min(maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 609 610 return maxPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 597 if (styleToUse->logicalMaxWidth().isFixed()) { 598 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 599 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 600 } 601 602 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 603 m_minPreferredLogicalWidth += borderAndPadding; 604 m_maxPreferredLogicalWidth += borderAndPadding; 605 setPreferredLogicalWidthsDirty(false); 611 606 } 612 607 … … 619 614 void RenderRegion::updateLogicalHeight() 620 615 { 621 Render Replaced::updateLogicalHeight();616 RenderBlock::updateLogicalHeight(); 622 617 623 618 if (!hasAutoLogicalHeight()) -
trunk/Source/WebCore/rendering/RenderRegion.h
r140948 r142984 31 31 #define RenderRegion_h 32 32 33 #include "Render Replaced.h"33 #include "RenderBlock.h" 34 34 #include "StyleInheritedData.h" 35 35 … … 41 41 class RenderNamedFlowThread; 42 42 43 class RenderRegion : public Render Replaced{43 class RenderRegion : public RenderBlock { 44 44 public: 45 45 explicit RenderRegion(Element*, RenderFlowThread*); … … 47 47 virtual bool isRenderRegion() const { return true; } 48 48 49 virtual void paintReplaced(PaintInfo&, const LayoutPoint&);50 49 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; 51 50 … … 68 67 bool hasCustomRegionStyle() const { return m_hasCustomRegionStyle; } 69 68 void setHasCustomRegionStyle(bool hasCustomRegionStyle) { m_hasCustomRegionStyle = hasCustomRegionStyle; } 70 71 virtual void layout();72 69 73 70 RenderBoxRegionInfo* renderBoxRegionInfo(const RenderBox*) const; … … 101 98 LayoutUnit maxPageLogicalHeight() const; 102 99 103 virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE; 104 virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE; 100 virtual void computePreferredLogicalWidths() OVERRIDE; 105 101 106 102 LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const; … … 143 139 virtual const char* renderName() const { return "RenderRegion"; } 144 140 145 // FIXME: these functions should be revisited once RenderRegion inherits from RenderBlock 146 // instead of RenderReplaced (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 147 // When width is auto, use normal block/box sizing code except when inline. 148 virtual bool isInlineBlockOrInlineTable() const OVERRIDE { return isInline() && !shouldComputeSizeAsReplaced(); } 149 virtual bool shouldComputeSizeAsReplaced() const OVERRIDE { return !style()->logicalWidth().isAuto() && !style()->logicalHeight().isAuto(); } 141 virtual bool canHaveChildren() const OVERRIDE { return false; } 150 142 151 143 bool shouldHaveAutoLogicalHeight() const … … 158 150 virtual void insertedIntoTree() OVERRIDE; 159 151 virtual void willBeRemovedFromTree() OVERRIDE; 152 153 virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE; 154 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE; 160 155 161 156 virtual void installFlowThread();
Note: See TracChangeset
for help on using the changeset viewer.