OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #include "core/rendering/RenderRubyBase.h" | 31 #include "core/rendering/RenderRubyBase.h" |
32 #include "core/rendering/RenderRubyRun.h" | 32 #include "core/rendering/RenderRubyRun.h" |
33 #include "core/rendering/RenderRubyText.h" | 33 #include "core/rendering/RenderRubyText.h" |
34 #include "core/rendering/RenderView.h" | 34 #include "core/rendering/RenderView.h" |
35 #include "core/rendering/RootInlineBox.h" | 35 #include "core/rendering/RootInlineBox.h" |
36 #include "platform/fonts/Font.h" | 36 #include "platform/fonts/Font.h" |
37 #include "platform/graphics/GraphicsContextStateSaver.h" | 37 #include "platform/graphics/GraphicsContextStateSaver.h" |
38 | 38 |
39 #include <math.h> | 39 #include <math.h> |
40 | 40 |
41 using namespace std; | |
42 | |
43 namespace WebCore { | 41 namespace WebCore { |
44 | 42 |
45 struct SameSizeAsInlineFlowBox : public InlineBox { | 43 struct SameSizeAsInlineFlowBox : public InlineBox { |
46 void* pointers[5]; | 44 void* pointers[5]; |
47 uint32_t bitfields : 23; | 45 uint32_t bitfields : 23; |
48 }; | 46 }; |
49 | 47 |
50 COMPILE_ASSERT(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), InlineF
lowBox_should_stay_small); | 48 COMPILE_ASSERT(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), InlineF
lowBox_should_stay_small); |
51 | 49 |
52 #ifndef NDEBUG | 50 #ifndef NDEBUG |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (curr->renderer().isText()) { | 380 if (curr->renderer().isText()) { |
383 InlineTextBox* text = toInlineTextBox(curr); | 381 InlineTextBox* text = toInlineTextBox(curr); |
384 RenderText& rt = toRenderText(text->renderer()); | 382 RenderText& rt = toRenderText(text->renderer()); |
385 if (rt.textLength()) { | 383 if (rt.textLength()) { |
386 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st
art()))) | 384 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st
art()))) |
387 logicalLeft += rt.style(isFirstLineStyle())->font().fontDesc
ription().wordSpacing(); | 385 logicalLeft += rt.style(isFirstLineStyle())->font().fontDesc
ription().wordSpacing(); |
388 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end())
); | 386 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end())
); |
389 } | 387 } |
390 text->setLogicalLeft(logicalLeft); | 388 text->setLogicalLeft(logicalLeft); |
391 if (knownToHaveNoOverflow()) | 389 if (knownToHaveNoOverflow()) |
392 minLogicalLeft = min(logicalLeft, minLogicalLeft); | 390 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
393 logicalLeft += text->logicalWidth(); | 391 logicalLeft += text->logicalWidth(); |
394 if (knownToHaveNoOverflow()) | 392 if (knownToHaveNoOverflow()) |
395 maxLogicalRight = max(logicalLeft, maxLogicalRight); | 393 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
396 } else { | 394 } else { |
397 if (curr->renderer().isOutOfFlowPositioned()) { | 395 if (curr->renderer().isOutOfFlowPositioned()) { |
398 if (curr->renderer().parent()->style()->isLeftToRightDirection()
) { | 396 if (curr->renderer().parent()->style()->isLeftToRightDirection()
) { |
399 curr->setLogicalLeft(logicalLeft); | 397 curr->setLogicalLeft(logicalLeft); |
400 } else { | 398 } else { |
401 // Our offset that we cache needs to be from the edge of the
right border box and | 399 // Our offset that we cache needs to be from the edge of the
right border box and |
402 // not the left border box. We have to subtract |x| from th
e width of the block | 400 // not the left border box. We have to subtract |x| from th
e width of the block |
403 // (which can be obtained from the root line box). | 401 // (which can be obtained from the root line box). |
404 curr->setLogicalLeft(root().block().logicalWidth() - logical
Left); | 402 curr->setLogicalLeft(root().block().logicalWidth() - logical
Left); |
405 } | 403 } |
406 continue; // The positioned object has no effect on the width. | 404 continue; // The positioned object has no effect on the width. |
407 } | 405 } |
408 if (curr->renderer().isRenderInline()) { | 406 if (curr->renderer().isRenderInline()) { |
409 InlineFlowBox* flow = toInlineFlowBox(curr); | 407 InlineFlowBox* flow = toInlineFlowBox(curr); |
410 logicalLeft += flow->marginLogicalLeft(); | 408 logicalLeft += flow->marginLogicalLeft(); |
411 if (knownToHaveNoOverflow()) | 409 if (knownToHaveNoOverflow()) |
412 minLogicalLeft = min(logicalLeft, minLogicalLeft); | 410 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
413 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee
dsWordSpacing, textBoxDataMap); | 411 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee
dsWordSpacing, textBoxDataMap); |
414 if (knownToHaveNoOverflow()) | 412 if (knownToHaveNoOverflow()) |
415 maxLogicalRight = max(logicalLeft, maxLogicalRight); | 413 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
416 logicalLeft += flow->marginLogicalRight(); | 414 logicalLeft += flow->marginLogicalRight(); |
417 } else if (!curr->renderer().isListMarker() || toRenderListMarker(cu
rr->renderer()).isInside()) { | 415 } else if (!curr->renderer().isListMarker() || toRenderListMarker(cu
rr->renderer()).isInside()) { |
418 // The box can have a different writing-mode than the overall li
ne, so this is a bit complicated. | 416 // The box can have a different writing-mode than the overall li
ne, so this is a bit complicated. |
419 // Just get all the physical margin and overflow values by hand
based off |isVertical|. | 417 // Just get all the physical margin and overflow values by hand
based off |isVertical|. |
420 LayoutUnit logicalLeftMargin = isHorizontal() ? curr->boxModelOb
ject()->marginLeft() : curr->boxModelObject()->marginTop(); | 418 LayoutUnit logicalLeftMargin = isHorizontal() ? curr->boxModelOb
ject()->marginLeft() : curr->boxModelObject()->marginTop(); |
421 LayoutUnit logicalRightMargin = isHorizontal() ? curr->boxModelO
bject()->marginRight() : curr->boxModelObject()->marginBottom(); | 419 LayoutUnit logicalRightMargin = isHorizontal() ? curr->boxModelO
bject()->marginRight() : curr->boxModelObject()->marginBottom(); |
422 | 420 |
423 logicalLeft += logicalLeftMargin; | 421 logicalLeft += logicalLeftMargin; |
424 curr->setLogicalLeft(logicalLeft); | 422 curr->setLogicalLeft(logicalLeft); |
425 if (knownToHaveNoOverflow()) | 423 if (knownToHaveNoOverflow()) |
426 minLogicalLeft = min(logicalLeft, minLogicalLeft); | 424 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
427 logicalLeft += curr->logicalWidth(); | 425 logicalLeft += curr->logicalWidth(); |
428 if (knownToHaveNoOverflow()) | 426 if (knownToHaveNoOverflow()) |
429 maxLogicalRight = max(logicalLeft, maxLogicalRight); | 427 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
430 logicalLeft += logicalRightMargin; | 428 logicalLeft += logicalRightMargin; |
431 // If we encounter any space after this inline block then ensure
it is treated as the space between two words. | 429 // If we encounter any space after this inline block then ensure
it is treated as the space between two words. |
432 needsWordSpacing = true; | 430 needsWordSpacing = true; |
433 } | 431 } |
434 } | 432 } |
435 } | 433 } |
436 return logicalLeft; | 434 return logicalLeft; |
437 } | 435 } |
438 | 436 |
439 bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo
ntsMap& textBoxDataMap) const | 437 bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo
ntsMap& textBoxDataMap) const |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 int lineHeight = curr->lineHeight(); | 483 int lineHeight = curr->lineHeight(); |
486 if (curr->verticalAlign() == TOP) { | 484 if (curr->verticalAlign() == TOP) { |
487 if (maxAscent + maxDescent < lineHeight) | 485 if (maxAscent + maxDescent < lineHeight) |
488 maxDescent = lineHeight - maxAscent; | 486 maxDescent = lineHeight - maxAscent; |
489 } | 487 } |
490 else { | 488 else { |
491 if (maxAscent + maxDescent < lineHeight) | 489 if (maxAscent + maxDescent < lineHeight) |
492 maxAscent = lineHeight - maxDescent; | 490 maxAscent = lineHeight - maxDescent; |
493 } | 491 } |
494 | 492 |
495 if (maxAscent + maxDescent >= max(maxPositionTop, maxPositionBottom)
) | 493 if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBo
ttom)) |
496 break; | 494 break; |
497 } | 495 } |
498 | 496 |
499 if (curr->isInlineFlowBox()) | 497 if (curr->isInlineFlowBox()) |
500 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce
nt, maxPositionTop, maxPositionBottom); | 498 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce
nt, maxPositionTop, maxPositionBottom); |
501 } | 499 } |
502 } | 500 } |
503 | 501 |
504 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit&
maxPositionTop, LayoutUnit& maxPositionBottom, | 502 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit&
maxPositionTop, LayoutUnit& maxPositionBottom, |
505 int& maxAscent, int& maxDescent, bo
ol& setMaxAscent, bool& setMaxDescent, | 503 int& maxAscent, int& maxDescent, bo
ol& setMaxAscent, bool& setMaxDescent, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (emphasisMarkIsOver != curr->renderer().style(isFirstLine
Style())->isFlippedLinesWritingMode()) | 688 if (emphasisMarkIsOver != curr->renderer().style(isFirstLine
Style())->isFlippedLinesWritingMode()) |
691 hasAnnotationsBefore = true; | 689 hasAnnotationsBefore = true; |
692 else | 690 else |
693 hasAnnotationsAfter = true; | 691 hasAnnotationsAfter = true; |
694 } | 692 } |
695 } | 693 } |
696 | 694 |
697 if (!setLineTop) { | 695 if (!setLineTop) { |
698 setLineTop = true; | 696 setLineTop = true; |
699 lineTop = newLogicalTop; | 697 lineTop = newLogicalTop; |
700 lineTopIncludingMargins = min(lineTop, newLogicalTopIncludingMar
gins); | 698 lineTopIncludingMargins = std::min(lineTop, newLogicalTopIncludi
ngMargins); |
701 } else { | 699 } else { |
702 lineTop = min(lineTop, newLogicalTop); | 700 lineTop = std::min(lineTop, newLogicalTop); |
703 lineTopIncludingMargins = min(lineTop, min(lineTopIncludingMargi
ns, newLogicalTopIncludingMargins)); | 701 lineTopIncludingMargins = std::min(lineTop, std::min(lineTopIncl
udingMargins, newLogicalTopIncludingMargins)); |
704 } | 702 } |
705 selectionBottom = max(selectionBottom, newLogicalTop + boxHeight - b
orderPaddingHeight); | 703 selectionBottom = std::max(selectionBottom, newLogicalTop + boxHeigh
t - borderPaddingHeight); |
706 lineBottom = max(lineBottom, newLogicalTop + boxHeight); | 704 lineBottom = std::max(lineBottom, newLogicalTop + boxHeight); |
707 lineBottomIncludingMargins = max(lineBottom, max(lineBottomIncluding
Margins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); | 705 lineBottomIncludingMargins = std::max(lineBottom, std::max(lineBotto
mIncludingMargins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); |
708 } | 706 } |
709 | 707 |
710 // Adjust boxes to use their real box y/height and not the logical heigh
t (as dictated by | 708 // Adjust boxes to use their real box y/height and not the logical heigh
t (as dictated by |
711 // line-height). | 709 // line-height). |
712 if (inlineFlowBox) | 710 if (inlineFlowBox) |
713 inlineFlowBox->placeBoxesInBlockDirection(top, maxHeight, maxAscent,
strictMode, lineTop, lineBottom, selectionBottom, setLineTop, | 711 inlineFlowBox->placeBoxesInBlockDirection(top, maxHeight, maxAscent,
strictMode, lineTop, lineBottom, selectionBottom, setLineTop, |
714 lineTopIncludingMargins, l
ineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineTy
pe); | 712 lineTopIncludingMargins, l
ineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineTy
pe); |
715 } | 713 } |
716 | 714 |
717 if (isRootBox) { | 715 if (isRootBox) { |
718 if (strictMode || hasTextChildren() || (descendantsHaveSameLineHeightAnd
Baseline() && hasTextDescendants())) { | 716 if (strictMode || hasTextChildren() || (descendantsHaveSameLineHeightAnd
Baseline() && hasTextDescendants())) { |
719 if (!setLineTop) { | 717 if (!setLineTop) { |
720 setLineTop = true; | 718 setLineTop = true; |
721 lineTop = pixelSnappedLogicalTop(); | 719 lineTop = pixelSnappedLogicalTop(); |
722 lineTopIncludingMargins = lineTop; | 720 lineTopIncludingMargins = lineTop; |
723 } else { | 721 } else { |
724 lineTop = min<LayoutUnit>(lineTop, pixelSnappedLogicalTop()); | 722 lineTop = std::min<LayoutUnit>(lineTop, pixelSnappedLogicalTop()
); |
725 lineTopIncludingMargins = min(lineTop, lineTopIncludingMargins); | 723 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMarg
ins); |
726 } | 724 } |
727 selectionBottom = max<LayoutUnit>(selectionBottom, pixelSnappedLogic
alBottom()); | 725 selectionBottom = std::max<LayoutUnit>(selectionBottom, pixelSnapped
LogicalBottom()); |
728 lineBottom = max<LayoutUnit>(lineBottom, pixelSnappedLogicalBottom()
); | 726 lineBottom = std::max<LayoutUnit>(lineBottom, pixelSnappedLogicalBot
tom()); |
729 lineBottomIncludingMargins = max(lineBottom, lineBottomIncludingMarg
ins); | 727 lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludin
gMargins); |
730 } | 728 } |
731 | 729 |
732 if (renderer().style()->isFlippedLinesWritingMode()) | 730 if (renderer().style()->isFlippedLinesWritingMode()) |
733 flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludi
ngMargins); | 731 flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludi
ngMargins); |
734 } | 732 } |
735 } | 733 } |
736 | 734 |
737 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const | 735 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const |
738 { | 736 { |
739 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 737 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
740 if (curr->renderer().isOutOfFlowPositioned()) | 738 if (curr->renderer().isOutOfFlowPositioned()) |
741 continue; // Positioned placeholders don't affect calculations. | 739 continue; // Positioned placeholders don't affect calculations. |
742 | 740 |
743 if (descendantsHaveSameLineHeightAndBaseline()) | 741 if (descendantsHaveSameLineHeightAndBaseline()) |
744 continue; | 742 continue; |
745 | 743 |
746 maxLogicalTop = max<float>(maxLogicalTop, curr->y()); | 744 maxLogicalTop = std::max<float>(maxLogicalTop, curr->y()); |
747 float localMaxLogicalTop = 0; | 745 float localMaxLogicalTop = 0; |
748 if (curr->isInlineFlowBox()) | 746 if (curr->isInlineFlowBox()) |
749 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); | 747 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); |
750 maxLogicalTop = max<float>(maxLogicalTop, localMaxLogicalTop); | 748 maxLogicalTop = std::max<float>(maxLogicalTop, localMaxLogicalTop); |
751 } | 749 } |
752 } | 750 } |
753 | 751 |
754 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lin
eBottom) | 752 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lin
eBottom) |
755 { | 753 { |
756 // Flip the box on the line such that the top is now relative to the lineBot
tom instead of the lineTop. | 754 // Flip the box on the line such that the top is now relative to the lineBot
tom instead of the lineTop. |
757 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); | 755 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); |
758 | 756 |
759 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 757 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
760 if (curr->renderer().isOutOfFlowPositioned()) | 758 if (curr->renderer().isOutOfFlowPositioned()) |
(...skipping 18 matching lines...) Expand all Loading... |
779 | 777 |
780 LayoutUnit boxShadowLogicalTop; | 778 LayoutUnit boxShadowLogicalTop; |
781 LayoutUnit boxShadowLogicalBottom; | 779 LayoutUnit boxShadowLogicalBottom; |
782 style->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogica
lBottom); | 780 style->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogica
lBottom); |
783 | 781 |
784 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since | 782 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since |
785 // the line is "upside down" in terms of block coordinates. | 783 // the line is "upside down" in terms of block coordinates. |
786 LayoutUnit shadowLogicalTop = style->isFlippedLinesWritingMode() ? -boxShado
wLogicalBottom : boxShadowLogicalTop; | 784 LayoutUnit shadowLogicalTop = style->isFlippedLinesWritingMode() ? -boxShado
wLogicalBottom : boxShadowLogicalTop; |
787 LayoutUnit shadowLogicalBottom = style->isFlippedLinesWritingMode() ? -boxSh
adowLogicalTop : boxShadowLogicalBottom; | 785 LayoutUnit shadowLogicalBottom = style->isFlippedLinesWritingMode() ? -boxSh
adowLogicalTop : boxShadowLogicalBottom; |
788 | 786 |
789 LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() + shadowL
ogicalTop, logicalVisualOverflow.y()); | 787 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() + sh
adowLogicalTop, logicalVisualOverflow.y()); |
790 LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + s
hadowLogicalBottom, logicalVisualOverflow.maxY()); | 788 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom(
) + shadowLogicalBottom, logicalVisualOverflow.maxY()); |
791 | 789 |
792 LayoutUnit boxShadowLogicalLeft; | 790 LayoutUnit boxShadowLogicalLeft; |
793 LayoutUnit boxShadowLogicalRight; | 791 LayoutUnit boxShadowLogicalRight; |
794 style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogi
calRight); | 792 style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogi
calRight); |
795 | 793 |
796 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() + boxSh
adowLogicalLeft, logicalVisualOverflow.x()); | 794 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() +
boxShadowLogicalLeft, logicalVisualOverflow.x()); |
797 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + box
ShadowLogicalRight, logicalVisualOverflow.maxX()); | 795 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight()
+ boxShadowLogicalRight, logicalVisualOverflow.maxX()); |
798 | 796 |
799 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, | 797 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, |
800 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); | 798 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
801 } | 799 } |
802 | 800 |
803 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) | 801 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) |
804 { | 802 { |
805 // border-image-outset on root line boxes is applying to the block and not t
o the lines. | 803 // border-image-outset on root line boxes is applying to the block and not t
o the lines. |
806 if (!parent()) | 804 if (!parent()) |
807 return; | 805 return; |
808 | 806 |
809 RenderStyle* style = renderer().style(isFirstLineStyle()); | 807 RenderStyle* style = renderer().style(isFirstLineStyle()); |
810 if (!style->hasBorderImageOutsets()) | 808 if (!style->hasBorderImageOutsets()) |
811 return; | 809 return; |
812 | 810 |
813 LayoutBoxExtent borderOutsets = style->borderImageOutsets(); | 811 LayoutBoxExtent borderOutsets = style->borderImageOutsets(); |
814 | 812 |
815 LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style->writingM
ode()); | 813 LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style->writingM
ode()); |
816 LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style->wr
itingMode()); | 814 LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style->wr
itingMode()); |
817 LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style->writin
gMode()); | 815 LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style->writin
gMode()); |
818 LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style->writ
ingMode()); | 816 LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style->writ
ingMode()); |
819 | 817 |
820 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since | 818 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since |
821 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. | 819 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. |
822 LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOut
setLogicalBottom : borderOutsetLogicalTop; | 820 LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOut
setLogicalBottom : borderOutsetLogicalTop; |
823 LayoutUnit outsetLogicalBottom = style->isFlippedLinesWritingMode() ? border
OutsetLogicalTop : borderOutsetLogicalBottom; | 821 LayoutUnit outsetLogicalBottom = style->isFlippedLinesWritingMode() ? border
OutsetLogicalTop : borderOutsetLogicalBottom; |
824 | 822 |
825 LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetL
ogicalTop, logicalVisualOverflow.y()); | 823 LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() - ou
tsetLogicalTop, logicalVisualOverflow.y()); |
826 LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + o
utsetLogicalBottom, logicalVisualOverflow.maxY()); | 824 LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom(
) + outsetLogicalBottom, logicalVisualOverflow.maxY()); |
827 | 825 |
828 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica
lLeft : LayoutUnit(); | 826 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica
lLeft : LayoutUnit(); |
829 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi
calRight : LayoutUnit(); | 827 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi
calRight : LayoutUnit(); |
830 | 828 |
831 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outse
tLogicalLeft, logicalVisualOverflow.x()); | 829 LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() -
outsetLogicalLeft, logicalVisualOverflow.x()); |
832 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + out
setLogicalRight, logicalVisualOverflow.maxX()); | 830 LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight()
+ outsetLogicalRight, logicalVisualOverflow.maxX()); |
833 | 831 |
834 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, | 832 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, |
835 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); | 833 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
836 } | 834 } |
837 | 835 |
838 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) | 836 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) |
839 { | 837 { |
840 // Outline on root line boxes is applied to the block and not to the lines. | 838 // Outline on root line boxes is applied to the block and not to the lines. |
841 if (!parent()) | 839 if (!parent()) |
842 return; | 840 return; |
(...skipping 24 matching lines...) Expand all Loading... |
867 int strokeOverflow = static_cast<int>(ceilf(style->textStrokeWidth() / 2.0f)
); | 865 int strokeOverflow = static_cast<int>(ceilf(style->textStrokeWidth() / 2.0f)
); |
868 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; | 866 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; |
869 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; | 867 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; |
870 int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; | 868 int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; |
871 int rightGlyphOverflow = strokeOverflow + rightGlyphEdge; | 869 int rightGlyphOverflow = strokeOverflow + rightGlyphEdge; |
872 | 870 |
873 TextEmphasisPosition emphasisMarkPosition; | 871 TextEmphasisPosition emphasisMarkPosition; |
874 if (style->textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasi
sMarkPosition(style, emphasisMarkPosition)) { | 872 if (style->textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasi
sMarkPosition(style, emphasisMarkPosition)) { |
875 int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmp
hasisMarkString()); | 873 int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmp
hasisMarkString()); |
876 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style->isFli
ppedLinesWritingMode())) | 874 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style->isFli
ppedLinesWritingMode())) |
877 topGlyphOverflow = min(topGlyphOverflow, -emphasisMarkHeight); | 875 topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); |
878 else | 876 else |
879 bottomGlyphOverflow = max(bottomGlyphOverflow, emphasisMarkHeight); | 877 bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeig
ht); |
880 } | 878 } |
881 | 879 |
882 // If letter-spacing is negative, we should factor that into right layout ov
erflow. (Even in RTL, letter-spacing is | 880 // If letter-spacing is negative, we should factor that into right layout ov
erflow. (Even in RTL, letter-spacing is |
883 // applied to the right, so this is not an issue with left overflow. | 881 // applied to the right, so this is not an issue with left overflow. |
884 rightGlyphOverflow -= min(0, (int)style->font().fontDescription().letterSpac
ing()); | 882 rightGlyphOverflow -= std::min(0, (int)style->font().fontDescription().lette
rSpacing()); |
885 | 883 |
886 LayoutUnit textShadowLogicalTop; | 884 LayoutUnit textShadowLogicalTop; |
887 LayoutUnit textShadowLogicalBottom; | 885 LayoutUnit textShadowLogicalBottom; |
888 style->getTextShadowBlockDirectionExtent(textShadowLogicalTop, textShadowLog
icalBottom); | 886 style->getTextShadowBlockDirectionExtent(textShadowLogicalTop, textShadowLog
icalBottom); |
889 | 887 |
890 LayoutUnit childOverflowLogicalTop = min<LayoutUnit>(textShadowLogicalTop +
topGlyphOverflow, topGlyphOverflow); | 888 LayoutUnit childOverflowLogicalTop = std::min<LayoutUnit>(textShadowLogicalT
op + topGlyphOverflow, topGlyphOverflow); |
891 LayoutUnit childOverflowLogicalBottom = max<LayoutUnit>(textShadowLogicalBot
tom + bottomGlyphOverflow, bottomGlyphOverflow); | 889 LayoutUnit childOverflowLogicalBottom = std::max<LayoutUnit>(textShadowLogic
alBottom + bottomGlyphOverflow, bottomGlyphOverflow); |
892 | 890 |
893 LayoutUnit textShadowLogicalLeft; | 891 LayoutUnit textShadowLogicalLeft; |
894 LayoutUnit textShadowLogicalRight; | 892 LayoutUnit textShadowLogicalRight; |
895 style->getTextShadowInlineDirectionExtent(textShadowLogicalLeft, textShadowL
ogicalRight); | 893 style->getTextShadowInlineDirectionExtent(textShadowLogicalLeft, textShadowL
ogicalRight); |
896 | 894 |
897 LayoutUnit childOverflowLogicalLeft = min<LayoutUnit>(textShadowLogicalLeft
+ leftGlyphOverflow, leftGlyphOverflow); | 895 LayoutUnit childOverflowLogicalLeft = std::min<LayoutUnit>(textShadowLogical
Left + leftGlyphOverflow, leftGlyphOverflow); |
898 LayoutUnit childOverflowLogicalRight = max<LayoutUnit>(textShadowLogicalRigh
t + rightGlyphOverflow, rightGlyphOverflow); | 896 LayoutUnit childOverflowLogicalRight = std::max<LayoutUnit>(textShadowLogica
lRight + rightGlyphOverflow, rightGlyphOverflow); |
899 | 897 |
900 LayoutUnit logicalTopVisualOverflow = min(textBox->pixelSnappedLogicalTop()
+ childOverflowLogicalTop, logicalVisualOverflow.y()); | 898 LayoutUnit logicalTopVisualOverflow = std::min(textBox->pixelSnappedLogicalT
op() + childOverflowLogicalTop, logicalVisualOverflow.y()); |
901 LayoutUnit logicalBottomVisualOverflow = max(textBox->pixelSnappedLogicalBot
tom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY()); | 899 LayoutUnit logicalBottomVisualOverflow = std::max(textBox->pixelSnappedLogic
alBottom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY()); |
902 LayoutUnit logicalLeftVisualOverflow = min(textBox->pixelSnappedLogicalLeft(
) + childOverflowLogicalLeft, logicalVisualOverflow.x()); | 900 LayoutUnit logicalLeftVisualOverflow = std::min(textBox->pixelSnappedLogical
Left() + childOverflowLogicalLeft, logicalVisualOverflow.x()); |
903 LayoutUnit logicalRightVisualOverflow = max(textBox->pixelSnappedLogicalRigh
t() + childOverflowLogicalRight, logicalVisualOverflow.maxX()); | 901 LayoutUnit logicalRightVisualOverflow = std::max(textBox->pixelSnappedLogica
lRight() + childOverflowLogicalRight, logicalVisualOverflow.maxX()); |
904 | 902 |
905 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, | 903 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, |
906 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); | 904 logicalRightVisualOverflow - logicalLeftV
isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
907 | 905 |
908 textBox->setLogicalOverflowRect(logicalVisualOverflow); | 906 textBox->setLogicalOverflowRect(logicalVisualOverflow); |
909 } | 907 } |
910 | 908 |
911 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox,
LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow) | 909 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox,
LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow) |
912 { | 910 { |
913 RenderBox& box = toRenderBox(inlineBox->renderer()); | 911 RenderBox& box = toRenderBox(inlineBox->renderer()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 LayoutUnit minY = frameRect.y(); | 1060 LayoutUnit minY = frameRect.y(); |
1063 LayoutUnit width = frameRect.width(); | 1061 LayoutUnit width = frameRect.width(); |
1064 LayoutUnit height = frameRect.height(); | 1062 LayoutUnit height = frameRect.height(); |
1065 | 1063 |
1066 // Constrain our hit testing to the line top and bottom if necessary. | 1064 // Constrain our hit testing to the line top and bottom if necessary. |
1067 bool noQuirksMode = renderer().document().inNoQuirksMode(); | 1065 bool noQuirksMode = renderer().document().inNoQuirksMode(); |
1068 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { | 1066 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { |
1069 RootInlineBox& rootBox = root(); | 1067 RootInlineBox& rootBox = root(); |
1070 LayoutUnit& top = isHorizontal() ? minY : minX; | 1068 LayoutUnit& top = isHorizontal() ? minY : minX; |
1071 LayoutUnit& logicalHeight = isHorizontal() ? height : width; | 1069 LayoutUnit& logicalHeight = isHorizontal() ? height : width; |
1072 LayoutUnit bottom = min(rootBox.lineBottom(), top + logicalHeight); | 1070 LayoutUnit bottom = std::min(rootBox.lineBottom(), top + logicalHeight); |
1073 top = max(rootBox.lineTop(), top); | 1071 top = std::max(rootBox.lineTop(), top); |
1074 logicalHeight = bottom - top; | 1072 logicalHeight = bottom - top; |
1075 } | 1073 } |
1076 | 1074 |
1077 // Move x/y to our coordinates. | 1075 // Move x/y to our coordinates. |
1078 LayoutRect rect(minX, minY, width, height); | 1076 LayoutRect rect(minX, minY, width, height); |
1079 flipForWritingMode(rect); | 1077 flipForWritingMode(rect); |
1080 rect.moveBy(accumulatedOffset); | 1078 rect.moveBy(accumulatedOffset); |
1081 | 1079 |
1082 if (visibleToHitTestRequest(request) && locationInContainer.intersects(rect)
) { | 1080 if (visibleToHitTestRequest(request) && locationInContainer.intersects(rect)
) { |
1083 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont
ainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y he
re, we want coords in the containing block's space. | 1081 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont
ainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y he
re, we want coords in the containing block's space. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 } | 1227 } |
1230 } | 1228 } |
1231 | 1229 |
1232 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const | 1230 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const |
1233 { | 1231 { |
1234 bool noQuirksMode = renderer().document().inNoQuirksMode(); | 1232 bool noQuirksMode = renderer().document().inNoQuirksMode(); |
1235 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { | 1233 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { |
1236 const RootInlineBox& rootBox = root(); | 1234 const RootInlineBox& rootBox = root(); |
1237 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); | 1235 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); |
1238 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width()
; | 1236 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width()
; |
1239 LayoutUnit bottom = min(rootBox.lineBottom(), logicalTop + logicalHeight
); | 1237 LayoutUnit bottom = std::min(rootBox.lineBottom(), logicalTop + logicalH
eight); |
1240 logicalTop = max(rootBox.lineTop(), logicalTop); | 1238 logicalTop = std::max(rootBox.lineTop(), logicalTop); |
1241 logicalHeight = bottom - logicalTop; | 1239 logicalHeight = bottom - logicalTop; |
1242 if (isHorizontal()) { | 1240 if (isHorizontal()) { |
1243 rect.setY(logicalTop); | 1241 rect.setY(logicalTop); |
1244 rect.setHeight(logicalHeight); | 1242 rect.setHeight(logicalHeight); |
1245 } else { | 1243 } else { |
1246 rect.setX(logicalTop); | 1244 rect.setX(logicalTop); |
1247 rect.setWidth(logicalHeight); | 1245 rect.setWidth(logicalHeight); |
1248 } | 1246 } |
1249 } | 1247 } |
1250 } | 1248 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1486 } |
1489 | 1487 |
1490 LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi
tion) const | 1488 LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi
tion) const |
1491 { | 1489 { |
1492 LayoutUnit result = 0; | 1490 LayoutUnit result = 0; |
1493 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 1491 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
1494 if (curr->renderer().isOutOfFlowPositioned()) | 1492 if (curr->renderer().isOutOfFlowPositioned()) |
1495 continue; // Positioned placeholders don't affect calculations. | 1493 continue; // Positioned placeholders don't affect calculations. |
1496 | 1494 |
1497 if (curr->isInlineFlowBox()) | 1495 if (curr->isInlineFlowBox()) |
1498 result = max(result, toInlineFlowBox(curr)->computeOverAnnotationAdj
ustment(allowedPosition)); | 1496 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati
onAdjustment(allowedPosition)); |
1499 | 1497 |
1500 if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && cur
r->renderer().style()->rubyPosition() == RubyPositionBefore) { | 1498 if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && cur
r->renderer().style()->rubyPosition() == RubyPositionBefore) { |
1501 RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); | 1499 RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); |
1502 RenderRubyText* rubyText = rubyRun.rubyText(); | 1500 RenderRubyText* rubyText = rubyRun.rubyText(); |
1503 if (!rubyText) | 1501 if (!rubyText) |
1504 continue; | 1502 continue; |
1505 | 1503 |
1506 if (!rubyRun.style()->isFlippedLinesWritingMode()) { | 1504 if (!rubyRun.style()->isFlippedLinesWritingMode()) { |
1507 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); | 1505 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); |
1508 if (topOfFirstRubyTextLine >= 0) | 1506 if (topOfFirstRubyTextLine >= 0) |
1509 continue; | 1507 continue; |
1510 topOfFirstRubyTextLine += curr->logicalTop(); | 1508 topOfFirstRubyTextLine += curr->logicalTop(); |
1511 result = max(result, allowedPosition - topOfFirstRubyTextLine); | 1509 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); |
1512 } else { | 1510 } else { |
1513 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1511 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1514 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1512 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1515 continue; | 1513 continue; |
1516 bottomOfLastRubyTextLine += curr->logicalTop(); | 1514 bottomOfLastRubyTextLine += curr->logicalTop(); |
1517 result = max(result, bottomOfLastRubyTextLine - allowedPosition)
; | 1515 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1518 } | 1516 } |
1519 } | 1517 } |
1520 | 1518 |
1521 if (curr->isInlineTextBox()) { | 1519 if (curr->isInlineTextBox()) { |
1522 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); | 1520 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); |
1523 TextEmphasisPosition emphasisMarkPosition; | 1521 TextEmphasisPosition emphasisMarkPosition; |
1524 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex
tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark
Position == TextEmphasisPositionOver) { | 1522 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex
tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark
Position == TextEmphasisPositionOver) { |
1525 if (!style->isFlippedLinesWritingMode()) { | 1523 if (!style->isFlippedLinesWritingMode()) { |
1526 int topOfEmphasisMark = curr->logicalTop() - style->font().e
mphasisMarkHeight(style->textEmphasisMarkString()); | 1524 int topOfEmphasisMark = curr->logicalTop() - style->font().e
mphasisMarkHeight(style->textEmphasisMarkString()); |
1527 result = max(result, allowedPosition - topOfEmphasisMark); | 1525 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1528 } else { | 1526 } else { |
1529 int bottomOfEmphasisMark = curr->logicalBottom() + style->fo
nt().emphasisMarkHeight(style->textEmphasisMarkString()); | 1527 int bottomOfEmphasisMark = curr->logicalBottom() + style->fo
nt().emphasisMarkHeight(style->textEmphasisMarkString()); |
1530 result = max(result, bottomOfEmphasisMark - allowedPosition)
; | 1528 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1531 } | 1529 } |
1532 } | 1530 } |
1533 } | 1531 } |
1534 } | 1532 } |
1535 return result; | 1533 return result; |
1536 } | 1534 } |
1537 | 1535 |
1538 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const | 1536 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const |
1539 { | 1537 { |
1540 LayoutUnit result = 0; | 1538 LayoutUnit result = 0; |
1541 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 1539 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
1542 if (curr->renderer().isOutOfFlowPositioned()) | 1540 if (curr->renderer().isOutOfFlowPositioned()) |
1543 continue; // Positioned placeholders don't affect calculations. | 1541 continue; // Positioned placeholders don't affect calculations. |
1544 | 1542 |
1545 if (curr->isInlineFlowBox()) | 1543 if (curr->isInlineFlowBox()) |
1546 result = max(result, toInlineFlowBox(curr)->computeUnderAnnotationAd
justment(allowedPosition)); | 1544 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat
ionAdjustment(allowedPosition)); |
1547 | 1545 |
1548 if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && cur
r->renderer().style()->rubyPosition() == RubyPositionAfter) { | 1546 if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && cur
r->renderer().style()->rubyPosition() == RubyPositionAfter) { |
1549 RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); | 1547 RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); |
1550 RenderRubyText* rubyText = rubyRun.rubyText(); | 1548 RenderRubyText* rubyText = rubyRun.rubyText(); |
1551 if (!rubyText) | 1549 if (!rubyText) |
1552 continue; | 1550 continue; |
1553 | 1551 |
1554 if (rubyRun.style()->isFlippedLinesWritingMode()) { | 1552 if (rubyRun.style()->isFlippedLinesWritingMode()) { |
1555 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); | 1553 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); |
1556 if (topOfFirstRubyTextLine >= 0) | 1554 if (topOfFirstRubyTextLine >= 0) |
1557 continue; | 1555 continue; |
1558 topOfFirstRubyTextLine += curr->logicalTop(); | 1556 topOfFirstRubyTextLine += curr->logicalTop(); |
1559 result = max(result, allowedPosition - topOfFirstRubyTextLine); | 1557 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); |
1560 } else { | 1558 } else { |
1561 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1559 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1562 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1560 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1563 continue; | 1561 continue; |
1564 bottomOfLastRubyTextLine += curr->logicalTop(); | 1562 bottomOfLastRubyTextLine += curr->logicalTop(); |
1565 result = max(result, bottomOfLastRubyTextLine - allowedPosition)
; | 1563 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1566 } | 1564 } |
1567 } | 1565 } |
1568 | 1566 |
1569 if (curr->isInlineTextBox()) { | 1567 if (curr->isInlineTextBox()) { |
1570 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); | 1568 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); |
1571 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text
EmphasisPosition() == TextEmphasisPositionUnder) { | 1569 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text
EmphasisPosition() == TextEmphasisPositionUnder) { |
1572 if (!style->isFlippedLinesWritingMode()) { | 1570 if (!style->isFlippedLinesWritingMode()) { |
1573 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle->font().emphasisMarkHeight(style->textEmphasisMarkString()); | 1571 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
1574 result = max(result, bottomOfEmphasisMark - allowedPosition)
; | 1572 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1575 } else { | 1573 } else { |
1576 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->f
ont().emphasisMarkHeight(style->textEmphasisMarkString()); | 1574 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->f
ont().emphasisMarkHeight(style->textEmphasisMarkString()); |
1577 result = max(result, allowedPosition - topOfEmphasisMark); | 1575 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1578 } | 1576 } |
1579 } | 1577 } |
1580 } | 1578 } |
1581 } | 1579 } |
1582 return result; | 1580 return result; |
1583 } | 1581 } |
1584 | 1582 |
1585 void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes
InLogicalOrder, CustomInlineBoxRangeReverse customReverseImplementation, void* u
serData) const | 1583 void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes
InLogicalOrder, CustomInlineBoxRangeReverse customReverseImplementation, void* u
serData) const |
1586 { | 1584 { |
1587 InlineBox* leaf = firstLeafChild(); | 1585 InlineBox* leaf = firstLeafChild(); |
1588 | 1586 |
1589 // FIXME: The reordering code is a copy of parts from BidiResolver::createBi
diRunsForLine, operating directly on InlineBoxes, instead of BidiRuns. | 1587 // FIXME: The reordering code is a copy of parts from BidiResolver::createBi
diRunsForLine, operating directly on InlineBoxes, instead of BidiRuns. |
1590 // Investigate on how this code could possibly be shared. | 1588 // Investigate on how this code could possibly be shared. |
1591 unsigned char minLevel = 128; | 1589 unsigned char minLevel = 128; |
1592 unsigned char maxLevel = 0; | 1590 unsigned char maxLevel = 0; |
1593 | 1591 |
1594 // First find highest and lowest levels, and initialize leafBoxesInLogicalOr
der with the leaf boxes in visual order. | 1592 // First find highest and lowest levels, and initialize leafBoxesInLogicalOr
der with the leaf boxes in visual order. |
1595 for (; leaf; leaf = leaf->nextLeafChild()) { | 1593 for (; leaf; leaf = leaf->nextLeafChild()) { |
1596 minLevel = min(minLevel, leaf->bidiLevel()); | 1594 minLevel = std::min(minLevel, leaf->bidiLevel()); |
1597 maxLevel = max(maxLevel, leaf->bidiLevel()); | 1595 maxLevel = std::max(maxLevel, leaf->bidiLevel()); |
1598 leafBoxesInLogicalOrder.append(leaf); | 1596 leafBoxesInLogicalOrder.append(leaf); |
1599 } | 1597 } |
1600 | 1598 |
1601 if (renderer().style()->rtlOrdering() == VisualOrder) | 1599 if (renderer().style()->rtlOrdering() == VisualOrder) |
1602 return; | 1600 return; |
1603 | 1601 |
1604 // Reverse of reordering of the line (L2 according to Bidi spec): | 1602 // Reverse of reordering of the line (L2 according to Bidi spec): |
1605 // L2. From the highest level found in the text to the lowest odd level on e
ach line, | 1603 // L2. From the highest level found in the text to the lowest odd level on e
ach line, |
1606 // reverse any contiguous sequence of characters that are at that level or h
igher. | 1604 // reverse any contiguous sequence of characters that are at that level or h
igher. |
1607 | 1605 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 ASSERT(child->prevOnLine() == prev); | 1657 ASSERT(child->prevOnLine() == prev); |
1660 prev = child; | 1658 prev = child; |
1661 } | 1659 } |
1662 ASSERT(prev == m_lastChild); | 1660 ASSERT(prev == m_lastChild); |
1663 #endif | 1661 #endif |
1664 } | 1662 } |
1665 | 1663 |
1666 #endif | 1664 #endif |
1667 | 1665 |
1668 } // namespace WebCore | 1666 } // namespace WebCore |
OLD | NEW |