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

Side by Side Diff: sky/engine/core/rendering/RenderInline.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 551 }
552 552
553 template<typename GeneratorContext> 553 template<typename GeneratorContext>
554 void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren derInline* container) const 554 void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren derInline* container) const
555 { 555 {
556 if (!culledInlineFirstLineBox()) { 556 if (!culledInlineFirstLineBox()) {
557 yield(FloatRect()); 557 yield(FloatRect());
558 return; 558 return;
559 } 559 }
560 560
561 bool isHorizontal = style()->isHorizontalWritingMode();
562
563 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 561 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
564 if (curr->isFloatingOrOutOfFlowPositioned()) 562 if (curr->isFloatingOrOutOfFlowPositioned())
565 continue; 563 continue;
566 564
567 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block 565 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block
568 // direction (aligned to the root box's baseline). 566 // direction (aligned to the root box's baseline).
569 if (curr->isBox()) { 567 if (curr->isBox()) {
570 RenderBox* currBox = toRenderBox(curr); 568 RenderBox* currBox = toRenderBox(curr);
571 if (currBox->inlineBoxWrapper()) { 569 if (currBox->inlineBoxWrapper()) {
572 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root(); 570 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root();
573 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 571 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
574 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height(); 572 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height();
575 if (isHorizontal) 573 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox->marg inLeft(), logicalTop, (currBox->width() + currBox->marginWidth()).toFloat(), log icalHeight));
576 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox-> marginLeft(), logicalTop, (currBox->width() + currBox->marginWidth()).toFloat(), logicalHeight));
577 else
578 yield(FloatRect(logicalTop, currBox->inlineBoxWrapper()->y() - currBox->marginTop(), logicalHeight, (currBox->height() + currBox->marginHeig ht()).toFloat()));
579 } 574 }
580 } else if (curr->isRenderInline()) { 575 } else if (curr->isRenderInline()) {
581 // If the child doesn't need line boxes either, then we can recur. 576 // If the child doesn't need line boxes either, then we can recur.
582 RenderInline* currInline = toRenderInline(curr); 577 RenderInline* currInline = toRenderInline(curr);
583 if (!currInline->alwaysCreateLineBoxes()) 578 if (!currInline->alwaysCreateLineBoxes())
584 currInline->generateCulledLineBoxRects(yield, container); 579 currInline->generateCulledLineBoxRects(yield, container);
585 else { 580 else {
586 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) { 581 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) {
587 RootInlineBox& rootBox = childLine->root(); 582 RootInlineBox& rootBox = childLine->root();
588 int logicalTop = rootBox.logicalTop() + (rootBox.renderer(). style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->st yle(rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 583 int logicalTop = rootBox.logicalTop() + (rootBox.renderer(). style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->st yle(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
589 int logicalHeight = container->style(rootBox.isFirstLineStyl e())->font().fontMetrics().height(); 584 int logicalHeight = container->style(rootBox.isFirstLineStyl e())->font().fontMetrics().height();
590 if (isHorizontal) 585 yield(FloatRect(childLine->x() - childLine->marginLogicalLef t(),
591 yield(FloatRect(childLine->x() - childLine->marginLogica lLeft(), 586 logicalTop,
592 logicalTop, 587 childLine->logicalWidth() + childLine->marginLogicalLeft () + childLine->marginLogicalRight(),
593 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight(), 588 logicalHeight));
594 logicalHeight));
595 else
596 yield(FloatRect(logicalTop,
597 childLine->y() - childLine->marginLogicalLeft(),
598 logicalHeight,
599 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight()));
600 } 589 }
601 } 590 }
602 } else if (curr->isText()) { 591 } else if (curr->isText()) {
603 RenderText* currText = toRenderText(curr); 592 RenderText* currText = toRenderText(curr);
604 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) { 593 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) {
605 RootInlineBox& rootBox = childText->root(); 594 RootInlineBox& rootBox = childText->root();
606 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 595 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
607 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height(); 596 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height();
608 if (isHorizontal) 597 yield(FloatRect(childText->x(), logicalTop, childText->logicalWi dth(), logicalHeight));
609 yield(FloatRect(childText->x(), logicalTop, childText->logic alWidth(), logicalHeight));
610 else
611 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c hildText->logicalWidth()));
612 } 598 }
613 } 599 }
614 } 600 }
615 } 601 }
616 602
617 namespace { 603 namespace {
618 604
619 class AbsoluteRectsGeneratorContext { 605 class AbsoluteRectsGeneratorContext {
620 public: 606 public:
621 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& acc umulatedOffset) 607 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& acc umulatedOffset)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // Return the width of the minimal left side and the maximal right side. 848 // Return the width of the minimal left side and the maximal right side.
863 float logicalLeftSide = 0; 849 float logicalLeftSide = 0;
864 float logicalRightSide = 0; 850 float logicalRightSide = 0;
865 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBo x()) { 851 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBo x()) {
866 if (curr == firstLineBox() || curr->logicalLeft() < logicalLeftSide) 852 if (curr == firstLineBox() || curr->logicalLeft() < logicalLeftSide)
867 logicalLeftSide = curr->logicalLeft(); 853 logicalLeftSide = curr->logicalLeft();
868 if (curr == firstLineBox() || curr->logicalRight() > logicalRightSid e) 854 if (curr == firstLineBox() || curr->logicalRight() > logicalRightSid e)
869 logicalRightSide = curr->logicalRight(); 855 logicalRightSide = curr->logicalRight();
870 } 856 }
871 857
872 bool isHorizontal = style()->isHorizontalWritingMode(); 858 float x = logicalLeftSide;
873 859 float y = firstLineBox()->y();
874 float x = isHorizontal ? logicalLeftSide : firstLineBox()->x(); 860 float width = logicalRightSide - logicalLeftSide;
875 float y = isHorizontal ? firstLineBox()->y() : logicalLeftSide; 861 float height = lastLineBox()->logicalBottom() - y;
876 float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLi neBox()->logicalBottom() - x;
877 float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logic alRightSide - logicalLeftSide;
878 result = enclosingIntRect(FloatRect(x, y, width, height)); 862 result = enclosingIntRect(FloatRect(x, y, width, height));
879 } 863 }
880 864
881 return result; 865 return result;
882 } 866 }
883 867
884 InlineBox* RenderInline::culledInlineFirstLineBox() const 868 InlineBox* RenderInline::culledInlineFirstLineBox() const
885 { 869 {
886 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 870 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
887 if (curr->isFloatingOrOutOfFlowPositioned()) 871 if (curr->isFloatingOrOutOfFlowPositioned())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 912 }
929 return 0; 913 return 0;
930 } 914 }
931 915
932 LayoutRect RenderInline::culledInlineVisualOverflowBoundingBox() const 916 LayoutRect RenderInline::culledInlineVisualOverflowBoundingBox() const
933 { 917 {
934 FloatRect floatResult; 918 FloatRect floatResult;
935 LinesBoundingBoxGeneratorContext context(floatResult); 919 LinesBoundingBoxGeneratorContext context(floatResult);
936 generateCulledLineBoxRects(context, this); 920 generateCulledLineBoxRects(context, this);
937 LayoutRect result(enclosingLayoutRect(floatResult)); 921 LayoutRect result(enclosingLayoutRect(floatResult));
938 bool isHorizontal = style()->isHorizontalWritingMode();
939 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 922 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
940 if (curr->isFloatingOrOutOfFlowPositioned()) 923 if (curr->isFloatingOrOutOfFlowPositioned())
941 continue; 924 continue;
942 925
943 // For overflow we just have to propagate by hand and recompute it all. 926 // For overflow we just have to propagate by hand and recompute it all.
944 if (curr->isBox()) { 927 if (curr->isBox()) {
945 RenderBox* currBox = toRenderBox(curr); 928 RenderBox* currBox = toRenderBox(curr);
946 if (!currBox->hasSelfPaintingLayer() && currBox->inlineBoxWrapper()) { 929 if (!currBox->hasSelfPaintingLayer() && currBox->inlineBoxWrapper()) {
947 LayoutRect logicalRect = currBox->logicalVisualOverflowRectForPr opagation(style()); 930 LayoutRect logicalRect = currBox->logicalVisualOverflowRectForPr opagation(style());
948 if (isHorizontal) { 931 logicalRect.moveBy(currBox->location());
949 logicalRect.moveBy(currBox->location()); 932 result.uniteIfNonZero(logicalRect);
950 result.uniteIfNonZero(logicalRect);
951 } else {
952 logicalRect.moveBy(currBox->location());
953 result.uniteIfNonZero(logicalRect.transposedRect());
954 }
955 } 933 }
956 } else if (curr->isRenderInline()) { 934 } else if (curr->isRenderInline()) {
957 // If the child doesn't need line boxes either, then we can recur. 935 // If the child doesn't need line boxes either, then we can recur.
958 RenderInline* currInline = toRenderInline(curr); 936 RenderInline* currInline = toRenderInline(curr);
959 if (!currInline->alwaysCreateLineBoxes()) 937 if (!currInline->alwaysCreateLineBoxes())
960 result.uniteIfNonZero(currInline->culledInlineVisualOverflowBoun dingBox()); 938 result.uniteIfNonZero(currInline->culledInlineVisualOverflowBoun dingBox());
961 else if (!currInline->hasSelfPaintingLayer()) 939 else if (!currInline->hasSelfPaintingLayer())
962 result.uniteIfNonZero(currInline->linesVisualOverflowBoundingBox ()); 940 result.uniteIfNonZero(currInline->linesVisualOverflowBoundingBox ());
963 } else if (curr->isText()) { 941 } else if (curr->isText()) {
964 // FIXME; Overflow from text boxes is lost. We will need to cache th is information in 942 // FIXME; Overflow from text boxes is lost. We will need to cache th is information in
(...skipping 22 matching lines...) Expand all
987 } 965 }
988 966
989 RootInlineBox& firstRootBox = firstLineBox()->root(); 967 RootInlineBox& firstRootBox = firstLineBox()->root();
990 RootInlineBox& lastRootBox = lastLineBox()->root(); 968 RootInlineBox& lastRootBox = lastLineBox()->root();
991 969
992 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo x.lineTop()); 970 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo x.lineTop());
993 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 971 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
994 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo otBox.lineBottom()) - logicalTop; 972 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo otBox.lineBottom()) - logicalTop;
995 973
996 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 974 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
997 if (!style()->isHorizontalWritingMode())
998 rect = rect.transposedRect();
999 return rect; 975 return rect;
1000 } 976 }
1001 977
1002 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn validationState) const 978 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn validationState) const
1003 { 979 {
1004 if (!firstLineBoxIncludingCulling() && !continuation()) 980 if (!firstLineBoxIncludingCulling() && !continuation())
1005 return LayoutRect(); 981 return LayoutRect();
1006 982
1007 LayoutRect paintInvalidationRect(linesVisualOverflowBoundingBox()); 983 LayoutRect paintInvalidationRect(linesVisualOverflowBoundingBox());
1008 bool hitPaintInvalidationContainer = false; 984 bool hitPaintInvalidationContainer = false;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 { 1086 {
1111 ASSERT(container == this->container()); 1087 ASSERT(container == this->container());
1112 1088
1113 LayoutSize offset; 1089 LayoutSize offset;
1114 if (isRelPositioned()) 1090 if (isRelPositioned())
1115 offset += offsetForInFlowPosition(); 1091 offset += offsetForInFlowPosition();
1116 1092
1117 if (container->hasOverflowClip()) 1093 if (container->hasOverflowClip())
1118 offset -= toRenderBox(container)->scrolledContentOffset(); 1094 offset -= toRenderBox(container)->scrolledContentOffset();
1119 1095
1096 // FIXME(sky): Remove now that it's always false?
1120 if (offsetDependsOnPoint) 1097 if (offsetDependsOnPoint)
1121 *offsetDependsOnPoint = container->isBox() && container->style()->isFlip pedBlocksWritingMode(); 1098 *offsetDependsOnPoint = false;
1122 1099
1123 return offset; 1100 return offset;
1124 } 1101 }
1125 1102
1126 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali dationContainer, TransformState& transformState, MapCoordinatesFlags mode, const PaintInvalidationState* paintInvalidationState) const 1103 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali dationContainer, TransformState& transformState, MapCoordinatesFlags mode, const PaintInvalidationState* paintInvalidationState) const
1127 { 1104 {
1128 if (paintInvalidationContainer == this) 1105 if (paintInvalidationContainer == this)
1129 return; 1106 return;
1130 1107
1131 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) { 1108 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) {
1132 LayoutSize offset = paintInvalidationState->paintOffset(); 1109 LayoutSize offset = paintInvalidationState->paintOffset();
1133 if (style()->hasInFlowPosition() && layer()) 1110 if (style()->hasInFlowPosition() && layer())
1134 offset += layer()->offsetForInFlowPosition(); 1111 offset += layer()->offsetForInFlowPosition();
1135 transformState.move(offset); 1112 transformState.move(offset);
1136 return; 1113 return;
1137 } 1114 }
1138 1115
1139 bool containerSkipped; 1116 bool containerSkipped;
1140 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); 1117 RenderObject* o = container(paintInvalidationContainer, &containerSkipped);
1141 if (!o) 1118 if (!o)
1142 return; 1119 return;
1143 1120
1144 if (mode & ApplyContainerFlip && o->isBox()) { 1121 if (mode & ApplyContainerFlip && o->isBox()) {
1145 if (o->style()->isFlippedBlocksWritingMode()) {
1146 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ;
1147 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum ns(centerPoint) - centerPoint);
1148 }
1149 mode &= ~ApplyContainerFlip; 1122 mode &= ~ApplyContainerFlip;
1150 } 1123 }
1151 1124
1152 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans formState.mappedPoint())); 1125 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans formState.mappedPoint()));
1153 1126
1154 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D()); 1127 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D());
1155 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { 1128 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) {
1156 TransformationMatrix t; 1129 TransformationMatrix t;
1157 getTransformFromContainer(o, containerOffset, t); 1130 getTransformFromContainer(o, containerOffset, t);
1158 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); 1131 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 pixelSnappedBox.maxY(), 1499 pixelSnappedBox.maxY(),
1527 pixelSnappedBox.maxX() + outlineWidth, 1500 pixelSnappedBox.maxX() + outlineWidth,
1528 pixelSnappedBox.maxY() + outlineWidth, 1501 pixelSnappedBox.maxY() + outlineWidth,
1529 BSBottom, outlineColor, outlineStyle, 1502 BSBottom, outlineColor, outlineStyle,
1530 outlineWidth, 1503 outlineWidth,
1531 outlineWidth, 1504 outlineWidth,
1532 antialias); 1505 antialias);
1533 } 1506 }
1534 1507
1535 } // namespace blink 1508 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderGrid.cpp ('k') | sky/engine/core/rendering/RenderLineBoxList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698