Changeset 90869 in webkit
- Timestamp:
- Jul 12, 2011 5:04:01 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90868 r90869 1 2011-07-12 Emil A Eklund <eae@chromium.org> 2 3 Switch InlineFlowBox to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=64399 5 6 Reviewed by Eric Seidel. 7 8 First step in moving floats over to the new layout abstraction. 9 10 No new tests, no new functionality. 11 12 * rendering/InlineBox.cpp: 13 (WebCore::InlineBox::logicalHeight): 14 * rendering/InlineBox.h: 15 (WebCore::InlineBox::logicalTop): 16 (WebCore::InlineBox::logicalBottom): 17 (WebCore::InlineBox::setLogicalTop): 18 * rendering/InlineFlowBox.cpp: 19 (WebCore::InlineFlowBox::adjustMaxAscentAndDescent): 20 (WebCore::InlineFlowBox::computeLogicalBoxHeights): 21 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): 22 (WebCore::InlineFlowBox::addBoxShadowVisualOverflow): 23 (WebCore::InlineFlowBox::addTextBoxVisualOverflow): 24 (WebCore::InlineFlowBox::addReplacedChildOverflow): 25 (WebCore::InlineFlowBox::constrainToLineTopAndBottomIfNeeded): 26 (WebCore::InlineFlowBox::computeOverAnnotationAdjustment): 27 (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): 28 * rendering/InlineFlowBox.h: 29 * rendering/RenderBlock.cpp: 30 (WebCore::RenderBlock::logicalRightSelectionGap): 31 * rendering/RenderBlock.h: 32 * rendering/RootInlineBox.cpp: 33 (WebCore::RootInlineBox::alignBoxesInBlockDirection): 34 (WebCore::RootInlineBox::lineSelectionGap): 35 (WebCore::RootInlineBox::ascentAndDescentForBox): 36 (WebCore::RootInlineBox::verticalPositionForBox): 37 * rendering/RootInlineBox.h: 38 * rendering/style/RenderStyle.cpp: 39 (WebCore::RenderStyle::getShadowExtent): 40 (WebCore::RenderStyle::getShadowHorizontalExtent): 41 (WebCore::RenderStyle::getShadowVerticalExtent): 42 * rendering/style/RenderStyle.h: 43 (WebCore::InheritedFlags::getTextShadowExtent): 44 (WebCore::InheritedFlags::getTextShadowHorizontalExtent): 45 (WebCore::InheritedFlags::getTextShadowVerticalExtent): 46 (WebCore::InheritedFlags::getTextShadowInlineDirectionExtent): 47 (WebCore::InheritedFlags::getTextShadowBlockDirectionExtent): 48 (WebCore::InheritedFlags::getBoxShadowExtent): 49 (WebCore::InheritedFlags::getBoxShadowHorizontalExtent): 50 (WebCore::InheritedFlags::getBoxShadowVerticalExtent): 51 (WebCore::InheritedFlags::getBoxShadowInlineDirectionExtent): 52 (WebCore::InheritedFlags::getBoxShadowBlockDirectionExtent): 53 (WebCore::InheritedFlags::getShadowInlineDirectionExtent): 54 (WebCore::InheritedFlags::getShadowBlockDirectionExtent): 55 * rendering/style/ShadowData.cpp: 56 (WebCore::calculateShadowExtent): 57 (WebCore::ShadowData::adjustRectForShadow): 58 * rendering/style/ShadowData.h: 59 (WebCore::ShadowData::ShadowData): 60 (WebCore::ShadowData::x): 61 (WebCore::ShadowData::y): 62 1 63 2011-07-12 Kenichi Ishibashi <bashi@chromium.org> 2 64 -
trunk/Source/WebCore/rendering/InlineBox.cpp
r90791 r90869 125 125 #endif 126 126 127 int InlineBox::logicalHeight() const127 LayoutUnit InlineBox::logicalHeight() const 128 128 { 129 129 #if ENABLE(SVG) … … 140 140 RenderBoxModelObject* flowObject = boxModelObject(); 141 141 const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics(); 142 int result = fontMetrics.height();142 LayoutUnit result = fontMetrics.height(); 143 143 if (parent()) 144 144 result += flowObject->borderAndPaddingLogicalHeight(); -
trunk/Source/WebCore/rendering/InlineBox.h
r90791 r90869 255 255 256 256 // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line. 257 int logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); }258 int logicalBottom() const { return logicalTop() + logicalHeight(); }259 void setLogicalTop( int top)257 LayoutUnit logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); } 258 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); } 259 void setLogicalTop(LayoutUnit top) 260 260 { 261 261 if (isHorizontal()) … … 270 270 271 271 // The logical height is our extent in the block flow direction, i.e., height for horizontal text and width for vertical text. 272 int logicalHeight() const;272 LayoutUnit logicalHeight() const; 273 273 274 274 FloatRect logicalFrameRect() const { return isHorizontal() ? IntRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : IntRect(m_topLeft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); } -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r90791 r90869 449 449 } 450 450 451 void InlineFlowBox::adjustMaxAscentAndDescent( int& maxAscent, int& maxDescent, int maxPositionTop, int maxPositionBottom)451 void InlineFlowBox::adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& maxDescent, LayoutUnit maxPositionTop, LayoutUnit maxPositionBottom) 452 452 { 453 453 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { … … 457 457 continue; // Positioned placeholders don't affect calculations. 458 458 if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) { 459 int lineHeight = curr->lineHeight();459 LayoutUnit lineHeight = curr->lineHeight(); 460 460 if (curr->verticalAlign() == TOP) { 461 461 if (maxAscent + maxDescent < lineHeight) … … 476 476 } 477 477 478 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, int& maxPositionTop, int& maxPositionBottom,479 int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,478 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, 479 LayoutUnit& maxAscent, LayoutUnit& maxDescent, bool& setMaxAscent, bool& setMaxDescent, 480 480 bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, 481 481 FontBaseline baselineType, VerticalPositionCache& verticalPositionCache) … … 502 502 if (isRootInlineBox()) { 503 503 // Examine our root box. 504 int ascent = 0;505 int descent = 0;504 LayoutUnit ascent = 0; 505 LayoutUnit descent = 0; 506 506 rootBox->ascentAndDescentForBox(rootBox, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent); 507 507 if (strictMode || hasTextChildren() || (!checkChildren && hasTextDescendants())) { … … 534 534 curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositionCache)); 535 535 536 int ascent = 0;537 int descent = 0;536 LayoutUnit ascent = 0; 537 LayoutUnit descent = 0; 538 538 rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent); 539 539 540 int boxHeight = ascent + descent;540 LayoutUnit boxHeight = ascent + descent; 541 541 if (curr->verticalAlign() == TOP) { 542 542 if (maxPositionTop < boxHeight) … … 573 573 } 574 574 575 void InlineFlowBox::placeBoxesInBlockDirection( int top, int maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop,575 void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, LayoutUnit maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, 576 576 LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType) 577 577 { … … 720 720 } 721 721 722 inline void InlineFlowBox::addBoxShadowVisualOverflow( IntRect& logicalVisualOverflow)722 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow) 723 723 { 724 724 if (!parent()) 725 725 return; // Box-shadow doesn't apply to root line boxes. 726 726 727 int boxShadowLogicalTop;728 int boxShadowLogicalBottom;727 LayoutUnit boxShadowLogicalTop; 728 LayoutUnit boxShadowLogicalBottom; 729 729 renderer()->style(m_firstLine)->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogicalBottom); 730 730 731 int logicalTopVisualOverflow = min(logicalTop() + boxShadowLogicalTop, logicalVisualOverflow.y());732 int logicalBottomVisualOverflow = max(logicalBottom() + boxShadowLogicalBottom, logicalVisualOverflow.maxY());733 734 int boxShadowLogicalLeft;735 int boxShadowLogicalRight;731 LayoutUnit logicalTopVisualOverflow = min(logicalTop() + boxShadowLogicalTop, logicalVisualOverflow.y()); 732 LayoutUnit logicalBottomVisualOverflow = max(logicalBottom() + boxShadowLogicalBottom, logicalVisualOverflow.maxY()); 733 734 LayoutUnit boxShadowLogicalLeft; 735 LayoutUnit boxShadowLogicalRight; 736 736 renderer()->style(m_firstLine)->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogicalRight); 737 737 738 int logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x());739 int logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX());740 741 logicalVisualOverflow = IntRect(logicalLeftVisualOverflow, logicalTopVisualOverflow,742 logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow);743 } 744 745 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, IntRect& logicalVisualOverflow)738 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x()); 739 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX()); 740 741 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow, 742 logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); 743 } 744 745 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) 746 746 { 747 747 if (textBox->knownToHaveNoOverflow()) … … 778 778 rightGlyphOverflow -= min(0, (int)style->font().letterSpacing()); 779 779 780 int textShadowLogicalTop;781 int textShadowLogicalBottom;780 LayoutUnit textShadowLogicalTop; 781 LayoutUnit textShadowLogicalBottom; 782 782 style->getTextShadowBlockDirectionExtent(textShadowLogicalTop, textShadowLogicalBottom); 783 783 784 int childOverflowLogicalTop = min(textShadowLogicalTop + topGlyphOverflow, topGlyphOverflow);785 int childOverflowLogicalBottom = max(textShadowLogicalBottom + bottomGlyphOverflow, bottomGlyphOverflow);784 LayoutUnit childOverflowLogicalTop = min<LayoutUnit>(textShadowLogicalTop + topGlyphOverflow, topGlyphOverflow); 785 LayoutUnit childOverflowLogicalBottom = max<LayoutUnit>(textShadowLogicalBottom + bottomGlyphOverflow, bottomGlyphOverflow); 786 786 787 int textShadowLogicalLeft;788 int textShadowLogicalRight;787 LayoutUnit textShadowLogicalLeft; 788 LayoutUnit textShadowLogicalRight; 789 789 style->getTextShadowInlineDirectionExtent(textShadowLogicalLeft, textShadowLogicalRight); 790 790 791 int childOverflowLogicalLeft = min(textShadowLogicalLeft + leftGlyphOverflow, leftGlyphOverflow);792 int childOverflowLogicalRight = max(textShadowLogicalRight + rightGlyphOverflow, rightGlyphOverflow);793 794 int logicalTopVisualOverflow = min(textBox->logicalTop() + childOverflowLogicalTop, logicalVisualOverflow.y());795 int logicalBottomVisualOverflow = max(textBox->logicalBottom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY());796 int logicalLeftVisualOverflow = min(textBox->pixelSnappedLogicalLeft() + childOverflowLogicalLeft, logicalVisualOverflow.x());797 int logicalRightVisualOverflow = max(textBox->pixelSnappedLogicalRight() + childOverflowLogicalRight, logicalVisualOverflow.maxX());798 799 logicalVisualOverflow = IntRect(logicalLeftVisualOverflow, logicalTopVisualOverflow,800 logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow);791 LayoutUnit childOverflowLogicalLeft = min<LayoutUnit>(textShadowLogicalLeft + leftGlyphOverflow, leftGlyphOverflow); 792 LayoutUnit childOverflowLogicalRight = max<LayoutUnit>(textShadowLogicalRight + rightGlyphOverflow, rightGlyphOverflow); 793 794 LayoutUnit logicalTopVisualOverflow = min(textBox->logicalTop() + childOverflowLogicalTop, logicalVisualOverflow.y()); 795 LayoutUnit logicalBottomVisualOverflow = max(textBox->logicalBottom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY()); 796 LayoutUnit logicalLeftVisualOverflow = min(textBox->pixelSnappedLogicalLeft() + childOverflowLogicalLeft, logicalVisualOverflow.x()); 797 LayoutUnit logicalRightVisualOverflow = max(textBox->pixelSnappedLogicalRight() + childOverflowLogicalRight, logicalVisualOverflow.maxX()); 798 799 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow, 800 logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); 801 801 802 802 textBox->setLogicalOverflowRect(logicalVisualOverflow); 803 803 } 804 804 805 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox, IntRect& logicalLayoutOverflow, IntRect& logicalVisualOverflow)805 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox, LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow) 806 806 { 807 807 RenderBox* box = toRenderBox(inlineBox->renderer()); … … 811 811 // for writing-mode differences. 812 812 if (!box->hasSelfPaintingLayer()) { 813 IntRect childLogicalVisualOverflow = box->logicalVisualOverflowRectForPropagation(renderer()->style());813 LayoutRect childLogicalVisualOverflow = box->logicalVisualOverflowRectForPropagation(renderer()->style()); 814 814 childLogicalVisualOverflow.move(inlineBox->logicalLeft(), inlineBox->logicalTop()); 815 815 logicalVisualOverflow.unite(childLogicalVisualOverflow); … … 819 819 // Otherwise the child border box propagates as layout overflow. This rectangle must include transforms and relative positioning 820 820 // and be adjusted for writing-mode differences. 821 IntRect childLogicalLayoutOverflow = box->logicalLayoutOverflowRectForPropagation(renderer()->style());821 LayoutRect childLogicalLayoutOverflow = box->logicalLayoutOverflowRectForPropagation(renderer()->style()); 822 822 childLogicalLayoutOverflow.move(inlineBox->logicalLeft(), inlineBox->logicalTop()); 823 823 logicalLayoutOverflow.unite(childLogicalLayoutOverflow); … … 1075 1075 } 1076 1076 1077 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded( IntRect& rect) const1077 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const 1078 1078 { 1079 1079 bool noQuirksMode = renderer()->document()->inNoQuirksMode(); 1080 1080 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAndBaseline() && hasTextDescendants())) { 1081 1081 const RootInlineBox* rootBox = root(); 1082 int logicalTop = isHorizontal() ? rect.y() : rect.x();1083 int logicalHeight = isHorizontal() ? rect.height() : rect.width();1084 int bottom = min(rootBox->lineBottom(), logicalTop + logicalHeight);1082 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); 1083 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width(); 1084 LayoutUnit bottom = min(rootBox->lineBottom(), logicalTop + logicalHeight); 1085 1085 logicalTop = max(rootBox->lineTop(), logicalTop); 1086 1086 logicalHeight = bottom - logicalTop; … … 1298 1298 } 1299 1299 1300 int InlineFlowBox::computeOverAnnotationAdjustment(int allowedPosition) const1301 { 1302 int result = 0;1300 LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const 1301 { 1302 LayoutUnit result = 0; 1303 1303 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1304 1304 if (curr->renderer()->isPositioned()) … … 1315 1315 1316 1316 if (!rubyRun->style()->isFlippedLinesWritingMode()) { 1317 int topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : 0);1317 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : 0); 1318 1318 if (topOfFirstRubyTextLine >= 0) 1319 1319 continue; … … 1321 1321 result = max(result, allowedPosition - topOfFirstRubyTextLine); 1322 1322 } else { 1323 int bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight());1323 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight()); 1324 1324 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) 1325 1325 continue; … … 1346 1346 } 1347 1347 1348 int InlineFlowBox::computeUnderAnnotationAdjustment(int allowedPosition) const1349 { 1350 int result = 0;1348 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) const 1349 { 1350 LayoutUnit result = 0; 1351 1351 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1352 1352 if (curr->renderer()->isPositioned()) … … 1360 1360 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) { 1361 1361 if (!style->isFlippedLinesWritingMode()) { 1362 int bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString());1362 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString()); 1363 1363 result = max(result, bottomOfEmphasisMark - allowedPosition); 1364 1364 } else { 1365 int topOfEmphasisMark = curr->logicalTop() - style->font().emphasisMarkHeight(style->textEmphasisMarkString());1365 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->font().emphasisMarkHeight(style->textEmphasisMarkString()); 1366 1366 result = max(result, allowedPosition - topOfEmphasisMark); 1367 1367 } -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r90791 r90869 166 166 int getFlowSpacingLogicalWidth(); 167 167 float placeBoxesInInlineDirection(float logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); 168 void computeLogicalBoxHeights(RootInlineBox*, int& maxPositionTop, int& maxPositionBottom,169 int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,168 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, 169 LayoutUnit& maxAscent, LayoutUnit& maxDescent, bool& setMaxAscent, bool& setMaxDescent, 170 170 bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontBaseline, VerticalPositionCache&); 171 void adjustMaxAscentAndDescent( int& maxAscent, int& maxDescent,172 int maxPositionTop, int maxPositionBottom);171 void adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& maxDescent, 172 LayoutUnit maxPositionTop, LayoutUnit maxPositionBottom); 173 173 void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight, LayoutUnit maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, 174 174 LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline); … … 176 176 bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) const; 177 177 178 int computeOverAnnotationAdjustment(int allowedPosition) const;179 int computeUnderAnnotationAdjustment(int allowedPosition) const;178 LayoutUnit computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const; 179 LayoutUnit computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) const; 180 180 181 181 void computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, GlyphOverflowAndFallbackFontsMap&); … … 274 274 275 275 private: 276 void addBoxShadowVisualOverflow( IntRect& logicalVisualOverflow);277 void addTextBoxVisualOverflow(InlineTextBox*, GlyphOverflowAndFallbackFontsMap&, IntRect& logicalVisualOverflow);278 void addReplacedChildOverflow(const InlineBox*, IntRect& logicalLayoutOverflow, IntRect& logicalVisualOverflow);279 void constrainToLineTopAndBottomIfNeeded( IntRect&) const;276 void addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow); 277 void addTextBoxVisualOverflow(InlineTextBox*, GlyphOverflowAndFallbackFontsMap&, LayoutRect& logicalVisualOverflow); 278 void addReplacedChildOverflow(const InlineBox*, LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow); 279 void constrainToLineTopAndBottomIfNeeded(LayoutRect&) const; 280 280 281 281 protected: -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90833 r90869 3030 3030 3031 3031 LayoutRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 3032 RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)3032 RenderObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo) 3033 3033 { 3034 3034 LayoutUnit rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop; -
trunk/Source/WebCore/rendering/RenderBlock.h
r90833 r90869 137 137 138 138 GapRects selectionGapRectsForRepaint(RenderBoxModelObject* repaintContainer); 139 IntRect logicalLeftSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,140 RenderObject* selObj, int logicalLeft, int logicalTop, int logicalHeight, const PaintInfo*);141 IntRect logicalRightSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,142 RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo*);139 LayoutRect logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 140 RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*); 141 LayoutRect logicalRightSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 142 RenderObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*); 143 143 void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap); 144 144 IntRect logicalRectToPhysicalRect(const IntPoint& physicalPosition, const IntRect& logicalRect); … … 627 627 GapRects blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 628 628 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo*); 629 IntRect blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,630 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo*);629 LayoutRect blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 630 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo*); 631 631 LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); 632 632 LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r90791 r90869 221 221 } 222 222 223 int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)223 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache) 224 224 { 225 225 #if ENABLE(SVG) … … 229 229 #endif 230 230 231 int maxPositionTop = 0;232 int maxPositionBottom = 0;233 int maxAscent = 0;234 int maxDescent = 0;231 LayoutUnit maxPositionTop = 0; 232 LayoutUnit maxPositionBottom = 0; 233 LayoutUnit maxAscent = 0; 234 LayoutUnit maxDescent = 0; 235 235 bool setMaxAscent = false; 236 236 bool setMaxDescent = false; … … 247 247 adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom); 248 248 249 int maxHeight = maxAscent + maxDescent;250 int lineTop = heightOfBlock;251 int lineBottom = heightOfBlock;252 int lineTopIncludingMargins = heightOfBlock;253 int lineBottomIncludingMargins = heightOfBlock;249 LayoutUnit maxHeight = maxAscent + maxDescent; 250 LayoutUnit lineTop = heightOfBlock; 251 LayoutUnit lineBottom = heightOfBlock; 252 LayoutUnit lineTopIncludingMargins = heightOfBlock; 253 LayoutUnit lineBottomIncludingMargins = heightOfBlock; 254 254 bool setLineTop = false; 255 255 bool hasAnnotationsBefore = false; … … 269 269 } 270 270 271 maxHeight = max (0, maxHeight);271 maxHeight = max<LayoutUnit>(0, maxHeight); 272 272 273 273 return heightOfBlock + maxHeight; … … 305 305 } 306 306 307 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,308 int selTop, int selHeight, const PaintInfo* paintInfo)307 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 308 LayoutUnit selTop, LayoutUnit selHeight, const PaintInfo* paintInfo) 309 309 { 310 310 RenderObject::SelectionState lineState = selectionState(); … … 333 333 if (firstBox && firstBox != lastBox) { 334 334 // Now fill in any gaps on the line that occurred between two selected elements. 335 int lastLogicalLeft = firstBox->logicalRight();335 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); 336 336 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone; 337 337 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) { 338 338 if (box->selectionState() != RenderObject::SelectionNone) { 339 IntRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft() - lastLogicalLeft, selHeight);340 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetFromRootBlock : IntSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));341 IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);339 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft() - lastLogicalLeft, selHeight); 340 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width())); 341 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect); 342 342 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.height() > 0) { 343 343 if (paintInfo && box->parent()->renderer()->style()->visibility() == VISIBLE) … … 566 566 } 567 567 568 void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, int& ascent, int& descent,568 void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, LayoutUnit& ascent, LayoutUnit& descent, 569 569 bool& affectsAscent, bool& affectsDescent) const 570 570 { … … 603 603 for (size_t i = 0; i < usedFonts->size(); ++i) { 604 604 const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics(); 605 int usedFontAscent = fontMetrics.ascent(baselineType());606 int usedFontDescent = fontMetrics.descent(baselineType());607 int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;608 int usedFontAscentAndLeading = usedFontAscent + halfLeading;609 int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;605 LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType()); 606 LayoutUnit usedFontDescent = fontMetrics.descent(baselineType()); 607 LayoutUnit halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2; 608 LayoutUnit usedFontAscentAndLeading = usedFontAscent + halfLeading; 609 LayoutUnit usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading; 610 610 if (includeFont) { 611 611 setAscentAndDescent(ascent, descent, usedFontAscent, usedFontDescent, ascentDescentSet); … … 668 668 } 669 669 670 int RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositionCache& verticalPositionCache)670 LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositionCache& verticalPositionCache) 671 671 { 672 672 if (box->renderer()->isText()) … … 686 686 bool isRenderInline = renderer->isRenderInline(); 687 687 if (isRenderInline && !firstLine) { 688 int verticalPosition = verticalPositionCache.get(renderer, baselineType());688 LayoutUnit verticalPosition = verticalPositionCache.get(renderer, baselineType()); 689 689 if (verticalPosition != PositionUndefined) 690 690 return verticalPosition; -
trunk/Source/WebCore/rendering/RootInlineBox.h
r90791 r90869 60 60 int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); } 61 61 62 int alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);62 LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&); 63 63 void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom) 64 64 { … … 112 112 InlineBox* lastSelectedBox(); 113 113 114 GapRects lineSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock, int selTop, int selHeight, const PaintInfo*);114 GapRects lineSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit selTop, LayoutUnit selHeight, const PaintInfo*); 115 115 116 116 RenderBlock* block() const; … … 141 141 IntRect paddedLayoutOverflowRect(int endPadding) const; 142 142 143 void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, int& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const;144 int verticalPositionForBox(InlineBox*, VerticalPositionCache&);143 void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, LayoutUnit& ascent, LayoutUnit& descent, bool& affectsAscent, bool& affectsDescent) const; 144 LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&); 145 145 bool includeLeadingForBox(InlineBox*) const; 146 146 bool includeFontForBox(InlineBox*) const; -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r90863 r90869 1065 1065 } 1066 1066 1067 void RenderStyle::getShadowExtent(const ShadowData* shadow, int &top, int &right, int &bottom, int &left) const1067 void RenderStyle::getShadowExtent(const ShadowData* shadow, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const 1068 1068 { 1069 1069 top = 0; … … 1084 1084 } 1085 1085 1086 void RenderStyle::getShadowHorizontalExtent(const ShadowData* shadow, int &left, int &right) const1086 void RenderStyle::getShadowHorizontalExtent(const ShadowData* shadow, LayoutUnit &left, LayoutUnit &right) const 1087 1087 { 1088 1088 left = 0; … … 1099 1099 } 1100 1100 1101 void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, int &top, int &bottom) const1101 void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, LayoutUnit &top, LayoutUnit &bottom) const 1102 1102 { 1103 1103 top = 0; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r90863 r90869 652 652 653 653 const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); } 654 void getTextShadowExtent( int& top, int& right, int& bottom, int& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }655 void getTextShadowHorizontalExtent( int& left, int& right) const { getShadowHorizontalExtent(textShadow(), left, right); }656 void getTextShadowVerticalExtent( int& top, int& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }657 void getTextShadowInlineDirectionExtent( int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }658 void getTextShadowBlockDirectionExtent( int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }654 void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); } 655 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); } 656 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); } 657 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); } 658 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); } 659 659 660 660 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; } … … 672 672 673 673 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); } 674 void getBoxShadowExtent( int& top, int& right, int& bottom, int& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }675 void getBoxShadowHorizontalExtent( int& left, int& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }676 void getBoxShadowVerticalExtent( int& top, int& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }677 void getBoxShadowInlineDirectionExtent( int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }678 void getBoxShadowBlockDirectionExtent( int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }674 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); } 675 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); } 676 void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); } 677 void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); } 678 void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); } 679 679 680 680 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); } … … 1357 1357 private: 1358 1358 void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; } 1359 void getShadowExtent(const ShadowData*, int& top, int& right, int& bottom, int& left) const;1360 void getShadowHorizontalExtent(const ShadowData*, int& left, int& right) const;1361 void getShadowVerticalExtent(const ShadowData*, int& top, int& bottom) const;1362 void getShadowInlineDirectionExtent(const ShadowData* shadow, int& logicalLeft, int& logicalRight) const1359 void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const; 1360 void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const; 1361 void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const; 1362 void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const 1363 1363 { 1364 1364 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight); 1365 1365 } 1366 void getShadowBlockDirectionExtent(const ShadowData* shadow, int& logicalTop, int& logicalBottom) const1366 void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const 1367 1367 { 1368 1368 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom); -
trunk/Source/WebCore/rendering/style/ShadowData.cpp
r85603 r90869 22 22 #include "config.h" 23 23 #include "ShadowData.h" 24 25 #include "FloatRect.h"26 #include "IntRect.h"27 24 28 25 using namespace std; … … 57 54 } 58 55 59 static inline void calculateShadowExtent(const ShadowData* shadow, int additionalOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBottom)56 static inline void calculateShadowExtent(const ShadowData* shadow, int additionalOutlineSize, LayoutUnit& shadowLeft, LayoutUnit& shadowRight, LayoutUnit& shadowTop, LayoutUnit& shadowBottom) 60 57 { 61 58 do { … … 87 84 void ShadowData::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize) const 88 85 { 89 int shadowLeft = 0;90 int shadowRight = 0;91 int shadowTop = 0;92 int shadowBottom = 0;86 LayoutUnit shadowLeft = 0; 87 LayoutUnit shadowRight = 0; 88 LayoutUnit shadowTop = 0; 89 LayoutUnit shadowBottom = 0; 93 90 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); 94 91 -
trunk/Source/WebCore/rendering/style/ShadowData.h
r85027 r90869 27 27 28 28 #include "Color.h" 29 #include "LayoutTypes.h" 29 30 #include <wtf/OwnPtr.h> 30 31 #include <wtf/PassOwnPtr.h> 31 32 32 33 namespace WebCore { 33 34 class FloatRect;35 class IntRect;36 34 37 35 enum ShadowStyle { Normal, Inset }; … … 52 50 } 53 51 54 ShadowData( int x, int y, int blur, int spread, ShadowStyle style, bool isWebkitBoxShadow, const Color& color)52 ShadowData(LayoutUnit x, LayoutUnit y, int blur, int spread, ShadowStyle style, bool isWebkitBoxShadow, const Color& color) 55 53 : m_x(x) 56 54 , m_y(y) … … 71 69 } 72 70 73 int x() const { return m_x; }74 int y() const { return m_y; }71 LayoutUnit x() const { return m_x; } 72 LayoutUnit y() const { return m_y; } 75 73 int blur() const { return m_blur; } 76 74 int spread() const { return m_spread; } … … 86 84 87 85 private: 88 int m_x;89 int m_y;86 LayoutUnit m_x; 87 LayoutUnit m_y; 90 88 int m_blur; 91 89 int m_spread;
Note: See TracChangeset
for help on using the changeset viewer.