Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: sky/engine/core/rendering/InlineFlowBox.cpp

Issue 684383002: Delete a ton more dead vertical writing mode code. (Closed) Base URL: git@github.com:domokit/mojo.git@writingmode1
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/InlineBox.cpp ('k') | sky/engine/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 lineTop = pixelSnappedLogicalTop(); 692 lineTop = pixelSnappedLogicalTop();
693 lineTopIncludingMargins = lineTop; 693 lineTopIncludingMargins = lineTop;
694 } else { 694 } else {
695 lineTop = std::min<LayoutUnit>(lineTop, pixelSnappedLogicalTop() ); 695 lineTop = std::min<LayoutUnit>(lineTop, pixelSnappedLogicalTop() );
696 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMarg ins); 696 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMarg ins);
697 } 697 }
698 selectionBottom = std::max<LayoutUnit>(selectionBottom, pixelSnapped LogicalBottom()); 698 selectionBottom = std::max<LayoutUnit>(selectionBottom, pixelSnapped LogicalBottom());
699 lineBottom = std::max<LayoutUnit>(lineBottom, pixelSnappedLogicalBot tom()); 699 lineBottom = std::max<LayoutUnit>(lineBottom, pixelSnappedLogicalBot tom());
700 lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludin gMargins); 700 lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludin gMargins);
701 } 701 }
702
703 if (renderer().style()->isFlippedLinesWritingMode())
704 flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludi ngMargins);
705 } 702 }
706 } 703 }
707 704
708 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const 705 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const
709 { 706 {
710 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 707 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
711 if (curr->renderer().isOutOfFlowPositioned()) 708 if (curr->renderer().isOutOfFlowPositioned())
712 continue; // Positioned placeholders don't affect calculations. 709 continue; // Positioned placeholders don't affect calculations.
713 710
714 if (descendantsHaveSameLineHeightAndBaseline()) 711 if (descendantsHaveSameLineHeightAndBaseline())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 RenderStyle* style = renderer().style(isFirstLineStyle()); 744 RenderStyle* style = renderer().style(isFirstLineStyle());
748 if (!style->boxShadow()) 745 if (!style->boxShadow())
749 return; 746 return;
750 747
751 LayoutUnit boxShadowLogicalTop; 748 LayoutUnit boxShadowLogicalTop;
752 LayoutUnit boxShadowLogicalBottom; 749 LayoutUnit boxShadowLogicalBottom;
753 style->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogica lBottom); 750 style->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogica lBottom);
754 751
755 // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite shadow that applies, since 752 // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite shadow that applies, since
756 // the line is "upside down" in terms of block coordinates. 753 // the line is "upside down" in terms of block coordinates.
757 LayoutUnit shadowLogicalTop = style->isFlippedLinesWritingMode() ? -boxShado wLogicalBottom : boxShadowLogicalTop; 754 LayoutUnit shadowLogicalTop = boxShadowLogicalTop;
758 LayoutUnit shadowLogicalBottom = style->isFlippedLinesWritingMode() ? -boxSh adowLogicalTop : boxShadowLogicalBottom; 755 LayoutUnit shadowLogicalBottom = boxShadowLogicalBottom;
759 756
760 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() + sh adowLogicalTop, logicalVisualOverflow.y()); 757 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() + sh adowLogicalTop, logicalVisualOverflow.y());
761 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom( ) + shadowLogicalBottom, logicalVisualOverflow.maxY()); 758 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom( ) + shadowLogicalBottom, logicalVisualOverflow.maxY());
762 759
763 LayoutUnit boxShadowLogicalLeft; 760 LayoutUnit boxShadowLogicalLeft;
764 LayoutUnit boxShadowLogicalRight; 761 LayoutUnit boxShadowLogicalRight;
765 style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogi calRight); 762 style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogi calRight);
766 763
767 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x()); 764 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x());
768 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX()); 765 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX());
(...skipping 14 matching lines...) Expand all
783 780
784 LayoutBoxExtent borderOutsets = style->borderImageOutsets(); 781 LayoutBoxExtent borderOutsets = style->borderImageOutsets();
785 782
786 LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(); 783 LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop();
787 LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(); 784 LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom();
788 LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(); 785 LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft();
789 LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(); 786 LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight();
790 787
791 // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since 788 // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since
792 // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes. 789 // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes.
793 LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOut setLogicalBottom : borderOutsetLogicalTop; 790 LayoutUnit outsetLogicalTop = borderOutsetLogicalTop;
794 LayoutUnit outsetLogicalBottom = style->isFlippedLinesWritingMode() ? border OutsetLogicalTop : borderOutsetLogicalBottom; 791 LayoutUnit outsetLogicalBottom = borderOutsetLogicalBottom;
795 792
796 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() - ou tsetLogicalTop, logicalVisualOverflow.y()); 793 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() - ou tsetLogicalTop, logicalVisualOverflow.y());
797 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom( ) + outsetLogicalBottom, logicalVisualOverflow.maxY()); 794 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom( ) + outsetLogicalBottom, logicalVisualOverflow.maxY());
798 795
799 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit(); 796 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit();
800 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit(); 797 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit();
801 798
802 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x()); 799 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x());
803 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX()); 800 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX());
804 801
(...skipping 16 matching lines...) Expand all
821 818
822 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) 819 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow)
823 { 820 {
824 if (textBox->knownToHaveNoOverflow()) 821 if (textBox->knownToHaveNoOverflow())
825 return; 822 return;
826 823
827 RenderStyle* style = textBox->renderer().style(isFirstLineStyle()); 824 RenderStyle* style = textBox->renderer().style(isFirstLineStyle());
828 825
829 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ; 826 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ;
830 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd; 827 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd;
831 bool isFlippedLine = style->isFlippedLinesWritingMode();
832 828
833 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom : glyphOverflow->top) : 0; 829 int topGlyphEdge = glyphOverflow ? glyphOverflow->top : 0;
834 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top : glyphOverflow->bottom) : 0; 830 int bottomGlyphEdge = glyphOverflow ? glyphOverflow->bottom : 0;
835 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; 831 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0;
836 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; 832 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0;
837 833
838 int strokeOverflow = static_cast<int>(ceilf(style->textStrokeWidth() / 2.0f) ); 834 int strokeOverflow = static_cast<int>(ceilf(style->textStrokeWidth() / 2.0f) );
839 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; 835 int topGlyphOverflow = -strokeOverflow - topGlyphEdge;
840 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; 836 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge;
841 int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; 837 int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge;
842 int rightGlyphOverflow = strokeOverflow + rightGlyphEdge; 838 int rightGlyphOverflow = strokeOverflow + rightGlyphEdge;
843 839
844 TextEmphasisPosition emphasisMarkPosition; 840 TextEmphasisPosition emphasisMarkPosition;
845 if (style->textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasi sMarkPosition(style, emphasisMarkPosition)) { 841 if (style->textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasi sMarkPosition(style, emphasisMarkPosition)) {
846 int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmp hasisMarkString()); 842 int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmp hasisMarkString());
847 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style->isFli ppedLinesWritingMode())) 843 if (emphasisMarkPosition == TextEmphasisPositionOver)
848 topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); 844 topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight);
849 else 845 else
850 bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeig ht); 846 bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeig ht);
851 } 847 }
852 848
853 // If letter-spacing is negative, we should factor that into right layout ov erflow. (Even in RTL, letter-spacing is 849 // If letter-spacing is negative, we should factor that into right layout ov erflow. (Even in RTL, letter-spacing is
854 // applied to the right, so this is not an issue with left overflow. 850 // applied to the right, so this is not an issue with left overflow.
855 rightGlyphOverflow -= std::min(0, (int)style->font().fontDescription().lette rSpacing()); 851 rightGlyphOverflow -= std::min(0, (int)style->font().fontDescription().lette rSpacing());
856 852
857 LayoutUnit textShadowLogicalTop; 853 LayoutUnit textShadowLogicalTop;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 if (curr->renderer().isOutOfFlowPositioned()) 1421 if (curr->renderer().isOutOfFlowPositioned())
1426 continue; // Positioned placeholders don't affect calculations. 1422 continue; // Positioned placeholders don't affect calculations.
1427 1423
1428 if (curr->isInlineFlowBox()) 1424 if (curr->isInlineFlowBox())
1429 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati onAdjustment(allowedPosition)); 1425 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati onAdjustment(allowedPosition));
1430 1426
1431 if (curr->isInlineTextBox()) { 1427 if (curr->isInlineTextBox()) {
1432 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); 1428 RenderStyle* style = curr->renderer().style(isFirstLineStyle());
1433 TextEmphasisPosition emphasisMarkPosition; 1429 TextEmphasisPosition emphasisMarkPosition;
1434 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark Position == TextEmphasisPositionOver) { 1430 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark Position == TextEmphasisPositionOver) {
1435 if (!style->isFlippedLinesWritingMode()) { 1431 int topOfEmphasisMark = curr->logicalTop() - style->font().empha sisMarkHeight(style->textEmphasisMarkString());
1436 int topOfEmphasisMark = curr->logicalTop() - style->font().e mphasisMarkHeight(style->textEmphasisMarkString()); 1432 result = std::max(result, allowedPosition - topOfEmphasisMark);
1437 result = std::max(result, allowedPosition - topOfEmphasisMar k);
1438 } else {
1439 int bottomOfEmphasisMark = curr->logicalBottom() + style->fo nt().emphasisMarkHeight(style->textEmphasisMarkString());
1440 result = std::max(result, bottomOfEmphasisMark - allowedPosi tion);
1441 }
1442 } 1433 }
1443 } 1434 }
1444 } 1435 }
1445 return result; 1436 return result;
1446 } 1437 }
1447 1438
1448 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos ition) const 1439 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos ition) const
1449 { 1440 {
1450 LayoutUnit result = 0; 1441 LayoutUnit result = 0;
1451 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1442 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1452 if (curr->renderer().isOutOfFlowPositioned()) 1443 if (curr->renderer().isOutOfFlowPositioned())
1453 continue; // Positioned placeholders don't affect calculations. 1444 continue; // Positioned placeholders don't affect calculations.
1454 1445
1455 if (curr->isInlineFlowBox()) 1446 if (curr->isInlineFlowBox())
1456 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat ionAdjustment(allowedPosition)); 1447 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat ionAdjustment(allowedPosition));
1457 1448
1458 if (curr->isInlineTextBox()) { 1449 if (curr->isInlineTextBox()) {
1459 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); 1450 RenderStyle* style = curr->renderer().style(isFirstLineStyle());
1460 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text EmphasisPosition() == TextEmphasisPositionUnder) { 1451 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text EmphasisPosition() == TextEmphasisPositionUnder) {
1461 if (!style->isFlippedLinesWritingMode()) { 1452 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style- >font().emphasisMarkHeight(style->textEmphasisMarkString());
1462 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st yle->font().emphasisMarkHeight(style->textEmphasisMarkString()); 1453 result = std::max(result, bottomOfEmphasisMark - allowedPosition );
1463 result = std::max(result, bottomOfEmphasisMark - allowedPosi tion);
1464 } else {
1465 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->f ont().emphasisMarkHeight(style->textEmphasisMarkString());
1466 result = std::max(result, allowedPosition - topOfEmphasisMar k);
1467 }
1468 } 1454 }
1469 } 1455 }
1470 } 1456 }
1471 return result; 1457 return result;
1472 } 1458 }
1473 1459
1474 void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes InLogicalOrder, CustomInlineBoxRangeReverse customReverseImplementation, void* u serData) const 1460 void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes InLogicalOrder, CustomInlineBoxRangeReverse customReverseImplementation, void* u serData) const
1475 { 1461 {
1476 InlineBox* leaf = firstLeafChild(); 1462 InlineBox* leaf = firstLeafChild();
1477 1463
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 ASSERT(child->prevOnLine() == prev); 1537 ASSERT(child->prevOnLine() == prev);
1552 prev = child; 1538 prev = child;
1553 } 1539 }
1554 ASSERT(prev == m_lastChild); 1540 ASSERT(prev == m_lastChild);
1555 #endif 1541 #endif
1556 } 1542 }
1557 1543
1558 #endif 1544 #endif
1559 1545
1560 } // namespace blink 1546 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/InlineBox.cpp ('k') | sky/engine/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698