OLD | NEW |
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 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 using namespace HTMLNames; | 66 using namespace HTMLNames; |
67 | 67 |
68 // Used by flexible boxes when flexing this element and by table cells. | 68 // Used by flexible boxes when flexing this element and by table cells. |
69 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; | 69 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; |
70 | 70 |
71 // Used by grid elements to properly size their grid items. | 71 // Used by grid elements to properly size their grid items. |
72 // FIXME: Move these into RenderBoxRareData. | 72 // FIXME: Move these into RenderBoxRareData. |
73 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; | 73 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; |
74 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; | 74 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; |
| 75 static OverrideSizeMap* gExtraInlineOffsetMap = 0; |
| 76 static OverrideSizeMap* gExtraBlockOffsetMap = 0; |
75 | 77 |
76 | 78 |
77 // Size of border belt for autoscroll. When mouse pointer in border belt, | 79 // Size of border belt for autoscroll. When mouse pointer in border belt, |
78 // autoscroll is started. | 80 // autoscroll is started. |
79 static const int autoscrollBeltSize = 20; | 81 static const int autoscrollBeltSize = 20; |
80 static const unsigned backgroundObscurationTestMaxDepth = 4; | 82 static const unsigned backgroundObscurationTestMaxDepth = 4; |
81 | 83 |
82 static bool skipBodyBackground(const RenderBox* bodyElementRenderer) | 84 static bool skipBodyBackground(const RenderBox* bodyElementRenderer) |
83 { | 85 { |
84 ASSERT(bodyElementRenderer->isBody()); | 86 ASSERT(bodyElementRenderer->isBody()); |
(...skipping 11 matching lines...) Expand all Loading... |
96 , m_minPreferredLogicalWidth(-1) | 98 , m_minPreferredLogicalWidth(-1) |
97 , m_maxPreferredLogicalWidth(-1) | 99 , m_maxPreferredLogicalWidth(-1) |
98 { | 100 { |
99 setIsBox(); | 101 setIsBox(); |
100 } | 102 } |
101 | 103 |
102 void RenderBox::willBeDestroyed() | 104 void RenderBox::willBeDestroyed() |
103 { | 105 { |
104 clearOverrideSize(); | 106 clearOverrideSize(); |
105 clearContainingBlockOverrideSize(); | 107 clearContainingBlockOverrideSize(); |
| 108 clearExtraInlineAndBlockOffests(); |
106 | 109 |
107 RenderBlock::removePercentHeightDescendantIfNeeded(this); | 110 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
108 | 111 |
109 ShapeOutsideInfo::removeInfo(*this); | 112 ShapeOutsideInfo::removeInfo(*this); |
110 | 113 |
111 RenderBoxModelObject::willBeDestroyed(); | 114 RenderBoxModelObject::willBeDestroyed(); |
112 } | 115 } |
113 | 116 |
114 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 117 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
115 { | 118 { |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 gOverrideContainingBlockLogicalWidthMap->remove(this); | 1015 gOverrideContainingBlockLogicalWidthMap->remove(this); |
1013 clearOverrideContainingBlockContentLogicalHeight(); | 1016 clearOverrideContainingBlockContentLogicalHeight(); |
1014 } | 1017 } |
1015 | 1018 |
1016 void RenderBox::clearOverrideContainingBlockContentLogicalHeight() | 1019 void RenderBox::clearOverrideContainingBlockContentLogicalHeight() |
1017 { | 1020 { |
1018 if (gOverrideContainingBlockLogicalHeightMap) | 1021 if (gOverrideContainingBlockLogicalHeightMap) |
1019 gOverrideContainingBlockLogicalHeightMap->remove(this); | 1022 gOverrideContainingBlockLogicalHeightMap->remove(this); |
1020 } | 1023 } |
1021 | 1024 |
| 1025 LayoutUnit RenderBox::extraInlineOffset() const |
| 1026 { |
| 1027 return gExtraInlineOffsetMap ? gExtraInlineOffsetMap->get(this) : LayoutUnit
(0); |
| 1028 } |
| 1029 |
| 1030 LayoutUnit RenderBox::extraBlockOffset() const |
| 1031 { |
| 1032 return gExtraBlockOffsetMap ? gExtraBlockOffsetMap->get(this) : LayoutUnit(0
); |
| 1033 } |
| 1034 |
| 1035 void RenderBox::setExtraInlineOffset(LayoutUnit inlineOffest) |
| 1036 { |
| 1037 if (!gExtraInlineOffsetMap) |
| 1038 gExtraInlineOffsetMap = new OverrideSizeMap; |
| 1039 gExtraInlineOffsetMap->set(this, inlineOffest); |
| 1040 } |
| 1041 |
| 1042 void RenderBox::setExtraBlockOffset(LayoutUnit blockOffest) |
| 1043 { |
| 1044 if (!gExtraBlockOffsetMap) |
| 1045 gExtraBlockOffsetMap = new OverrideSizeMap; |
| 1046 gExtraBlockOffsetMap->set(this, blockOffest); |
| 1047 } |
| 1048 |
| 1049 void RenderBox::clearExtraInlineAndBlockOffests() |
| 1050 { |
| 1051 if (gExtraInlineOffsetMap) |
| 1052 gExtraInlineOffsetMap->remove(this); |
| 1053 if (gExtraBlockOffsetMap) |
| 1054 gExtraBlockOffsetMap->remove(this); |
| 1055 } |
| 1056 |
1022 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const | 1057 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const |
1023 { | 1058 { |
1024 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); | 1059 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); |
1025 if (style()->boxSizing() == CONTENT_BOX) | 1060 if (style()->boxSizing() == CONTENT_BOX) |
1026 return width + bordersPlusPadding; | 1061 return width + bordersPlusPadding; |
1027 return std::max(width, bordersPlusPadding); | 1062 return std::max(width, bordersPlusPadding); |
1028 } | 1063 } |
1029 | 1064 |
1030 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const | 1065 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const |
1031 { | 1066 { |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 | 2644 |
2610 // Use viewport as container for top-level fixed-position elements. | 2645 // Use viewport as container for top-level fixed-position elements. |
2611 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ | 2646 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ |
2612 const RenderView* view = toRenderView(containingBlock); | 2647 const RenderView* view = toRenderView(containingBlock); |
2613 if (FrameView* frameView = view->frameView()) { | 2648 if (FrameView* frameView = view->frameView()) { |
2614 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte
ntRect(); | 2649 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte
ntRect(); |
2615 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid
th() : viewportRect.height(); | 2650 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid
th() : viewportRect.height(); |
2616 } | 2651 } |
2617 } | 2652 } |
2618 | 2653 |
| 2654 if (hasOverrideContainingBlockLogicalWidth()) |
| 2655 return overrideContainingBlockContentLogicalWidth(); |
| 2656 |
2619 if (containingBlock->isBox()) | 2657 if (containingBlock->isBox()) |
2620 return toRenderBox(containingBlock)->clientLogicalWidth(); | 2658 return toRenderBox(containingBlock)->clientLogicalWidth(); |
2621 | 2659 |
2622 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned
()); | 2660 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned
()); |
2623 | 2661 |
2624 const RenderInline* flow = toRenderInline(containingBlock); | 2662 const RenderInline* flow = toRenderInline(containingBlock); |
2625 InlineFlowBox* first = flow->firstLineBox(); | 2663 InlineFlowBox* first = flow->firstLineBox(); |
2626 InlineFlowBox* last = flow->lastLineBox(); | 2664 InlineFlowBox* last = flow->lastLineBox(); |
2627 | 2665 |
2628 // If the containing block is empty, return a width of 0. | 2666 // If the containing block is empty, return a width of 0. |
(...skipping 20 matching lines...) Expand all Loading... |
2649 | 2687 |
2650 // Use viewport as container for top-level fixed-position elements. | 2688 // Use viewport as container for top-level fixed-position elements. |
2651 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ | 2689 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ |
2652 const RenderView* view = toRenderView(containingBlock); | 2690 const RenderView* view = toRenderView(containingBlock); |
2653 if (FrameView* frameView = view->frameView()) { | 2691 if (FrameView* frameView = view->frameView()) { |
2654 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte
ntRect(); | 2692 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte
ntRect(); |
2655 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei
ght() : viewportRect.width(); | 2693 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei
ght() : viewportRect.width(); |
2656 } | 2694 } |
2657 } | 2695 } |
2658 | 2696 |
| 2697 if (hasOverrideContainingBlockLogicalHeight()) |
| 2698 return overrideContainingBlockContentLogicalHeight(); |
| 2699 |
2659 if (containingBlock->isBox()) { | 2700 if (containingBlock->isBox()) { |
2660 const RenderBlock* cb = containingBlock->isRenderBlock() ? | 2701 const RenderBlock* cb = containingBlock->isRenderBlock() ? |
2661 toRenderBlock(containingBlock) : containingBlock->containingBlock(); | 2702 toRenderBlock(containingBlock) : containingBlock->containingBlock(); |
2662 return cb->clientLogicalHeight(); | 2703 return cb->clientLogicalHeight(); |
2663 } | 2704 } |
2664 | 2705 |
2665 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned
()); | 2706 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned
()); |
2666 | 2707 |
2667 const RenderInline* flow = toRenderInline(containingBlock); | 2708 const RenderInline* flow = toRenderInline(containingBlock); |
2668 InlineFlowBox* first = flow->firstLineBox(); | 2709 InlineFlowBox* first = flow->firstLineBox(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2835 minValues); | 2876 minValues); |
2836 | 2877 |
2837 if (computedValues.m_extent < minValues.m_extent) { | 2878 if (computedValues.m_extent < minValues.m_extent) { |
2838 computedValues.m_extent = minValues.m_extent; | 2879 computedValues.m_extent = minValues.m_extent; |
2839 computedValues.m_position = minValues.m_position; | 2880 computedValues.m_position = minValues.m_position; |
2840 computedValues.m_margins.m_start = minValues.m_margins.m_start; | 2881 computedValues.m_margins.m_start = minValues.m_margins.m_start; |
2841 computedValues.m_margins.m_end = minValues.m_margins.m_end; | 2882 computedValues.m_margins.m_end = minValues.m_margins.m_end; |
2842 } | 2883 } |
2843 } | 2884 } |
2844 | 2885 |
| 2886 if (!style()->hasStaticInlinePosition(isHorizontal)) |
| 2887 computedValues.m_position += extraInlineOffset(); |
| 2888 |
2845 computedValues.m_extent += bordersPlusPadding; | 2889 computedValues.m_extent += bordersPlusPadding; |
2846 } | 2890 } |
2847 | 2891 |
2848 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) | 2892 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) |
2849 { | 2893 { |
2850 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped | 2894 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped |
2851 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. | 2895 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. |
2852 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { | 2896 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { |
2853 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; | 2897 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; |
2854 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); | 2898 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 minValues); | 3178 minValues); |
3135 | 3179 |
3136 if (computedValues.m_extent < minValues.m_extent) { | 3180 if (computedValues.m_extent < minValues.m_extent) { |
3137 computedValues.m_extent = minValues.m_extent; | 3181 computedValues.m_extent = minValues.m_extent; |
3138 computedValues.m_position = minValues.m_position; | 3182 computedValues.m_position = minValues.m_position; |
3139 computedValues.m_margins.m_before = minValues.m_margins.m_before; | 3183 computedValues.m_margins.m_before = minValues.m_margins.m_before; |
3140 computedValues.m_margins.m_after = minValues.m_margins.m_after; | 3184 computedValues.m_margins.m_after = minValues.m_margins.m_after; |
3141 } | 3185 } |
3142 } | 3186 } |
3143 | 3187 |
| 3188 if (!style()->hasStaticBlockPosition(isHorizontalWritingMode())) |
| 3189 computedValues.m_position += extraBlockOffset(); |
| 3190 |
3144 // Set final height value. | 3191 // Set final height value. |
3145 computedValues.m_extent += bordersPlusPadding; | 3192 computedValues.m_extent += bordersPlusPadding; |
3146 } | 3193 } |
3147 | 3194 |
3148 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const R
enderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* cont
ainerBlock, LayoutUnit containerLogicalHeight) | 3195 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const R
enderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* cont
ainerBlock, LayoutUnit containerLogicalHeight) |
3149 { | 3196 { |
3150 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped | 3197 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped |
3151 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. | 3198 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. |
3152 if ((child->style()->isFlippedBlocksWritingMode() && child->isHorizontalWrit
ingMode() != containerBlock->isHorizontalWritingMode()) | 3199 if ((child->style()->isFlippedBlocksWritingMode() && child->isHorizontalWrit
ingMode() != containerBlock->isHorizontalWritingMode()) |
3153 || (child->style()->isFlippedBlocksWritingMode() != containerBlock->styl
e()->isFlippedBlocksWritingMode() && child->isHorizontalWritingMode() == contain
erBlock->isHorizontalWritingMode())) | 3200 || (child->style()->isFlippedBlocksWritingMode() != containerBlock->styl
e()->isFlippedBlocksWritingMode() && child->isHorizontalWritingMode() == contain
erBlock->isHorizontalWritingMode())) |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4437 computedValues.m_margins.m_end = marginEnd(); | 4484 computedValues.m_margins.m_end = marginEnd(); |
4438 | 4485 |
4439 setLogicalTop(oldLogicalTop); | 4486 setLogicalTop(oldLogicalTop); |
4440 setLogicalWidth(oldLogicalWidth); | 4487 setLogicalWidth(oldLogicalWidth); |
4441 setLogicalLeft(oldLogicalLeft); | 4488 setLogicalLeft(oldLogicalLeft); |
4442 setMarginLeft(oldMarginLeft); | 4489 setMarginLeft(oldMarginLeft); |
4443 setMarginRight(oldMarginRight); | 4490 setMarginRight(oldMarginRight); |
4444 } | 4491 } |
4445 | 4492 |
4446 } // namespace blink | 4493 } // namespace blink |
OLD | NEW |