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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. 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 |
11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
13 * | 13 * |
14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
18 * | 18 * |
19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
23 * | 23 * |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/rendering/RenderBoxModelObject.h" | 27 #include "core/rendering/RenderBoxModelObject.h" |
28 | 28 |
29 #include "HTMLNames.h" | 29 #include "HTMLNames.h" |
| 30 #include "core/frame/Settings.h" |
30 #include "core/html/HTMLFrameOwnerElement.h" | 31 #include "core/html/HTMLFrameOwnerElement.h" |
31 #include "core/frame/Settings.h" | |
32 #include "core/page/scrolling/ScrollingConstraints.h" | 32 #include "core/page/scrolling/ScrollingConstraints.h" |
33 #include "core/rendering/CompositedLayerMapping.h" | 33 #include "core/rendering/CompositedLayerMapping.h" |
34 #include "core/rendering/ImageQualityController.h" | 34 #include "core/rendering/ImageQualityController.h" |
35 #include "core/rendering/RenderBlock.h" | 35 #include "core/rendering/RenderBlock.h" |
36 #include "core/rendering/RenderGeometryMap.h" | 36 #include "core/rendering/RenderGeometryMap.h" |
37 #include "core/rendering/RenderInline.h" | 37 #include "core/rendering/RenderInline.h" |
38 #include "core/rendering/RenderLayer.h" | 38 #include "core/rendering/RenderLayer.h" |
39 #include "core/rendering/RenderLayerCompositor.h" | 39 #include "core/rendering/RenderLayerCompositor.h" |
40 #include "core/rendering/RenderNamedFlowThread.h" | 40 #include "core/rendering/RenderNamedFlowThread.h" |
41 #include "core/rendering/RenderRegion.h" | 41 #include "core/rendering/RenderRegion.h" |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject
: this; | 1055 RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject
: this; |
1056 IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize)
; | 1056 IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize)
; |
1057 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fi
llTileSize, style()->effectiveZoom()); | 1057 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fi
llTileSize, style()->effectiveZoom()); |
1058 geometry.setTileSize(fillTileSize); | 1058 geometry.setTileSize(fillTileSize); |
1059 | 1059 |
1060 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); | 1060 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); |
1061 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); | 1061 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); |
1062 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); | 1062 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); |
1063 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); | 1063 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); |
1064 | 1064 |
1065 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(),
availableWidth, true); | 1065 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer->xPosi
tion(), availableWidth); |
1066 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil
lTileSize.width() > 0) { | 1066 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil
lTileSize.width() > 0) { |
1067 long nrTiles = max(1l, lroundf((float)positioningAreaSize.width() / fill
TileSize.width())); | 1067 long nrTiles = max(1l, lroundf((float)positioningAreaSize.width() / fill
TileSize.width())); |
1068 | 1068 |
1069 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou
ndFill) { | 1069 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou
ndFill) { |
1070 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w
idth() / (nrTiles * fillTileSize.width())); | 1070 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w
idth() / (nrTiles * fillTileSize.width())); |
1071 } | 1071 } |
1072 | 1072 |
1073 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); | 1073 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); |
1074 geometry.setTileSize(fillTileSize); | 1074 geometry.setTileSize(fillTileSize); |
1075 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); | 1075 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); |
1076 geometry.setSpaceSize(IntSize()); | 1076 geometry.setSpaceSize(IntSize()); |
1077 } | 1077 } |
1078 | 1078 |
1079 LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(),
availableHeight, true); | 1079 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer->yPosi
tion(), availableHeight); |
1080 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi
llTileSize.height() > 0) { | 1080 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi
llTileSize.height() > 0) { |
1081 long nrTiles = max(1l, lroundf((float)positioningAreaSize.height() / fil
lTileSize.height())); | 1081 long nrTiles = max(1l, lroundf((float)positioningAreaSize.height() / fil
lTileSize.height())); |
1082 | 1082 |
1083 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun
dFill) { | 1083 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun
dFill) { |
1084 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei
ght() / (nrTiles * fillTileSize.height())); | 1084 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei
ght() / (nrTiles * fillTileSize.height())); |
1085 } | 1085 } |
1086 | 1086 |
1087 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); | 1087 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); |
1088 geometry.setTileSize(fillTileSize); | 1088 geometry.setTileSize(fillTileSize); |
1089 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; | 1089 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; |
1090 geometry.setSpaceSize(IntSize()); | 1090 geometry.setSpaceSize(IntSize()); |
1091 } | 1091 } |
1092 | 1092 |
1093 if (backgroundRepeatX == RepeatFill) { | 1093 if (backgroundRepeatX == RepeatFill) { |
1094 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); | 1094 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); |
1095 geometry.setSpaceSize(IntSize()); | 1095 geometry.setSpaceSize(IntSize()); |
1096 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { | 1096 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { |
1097 int space = getSpace(positioningAreaSize.width(), geometry.tileSize().wi
dth()); | 1097 int space = getSpace(positioningAreaSize.width(), geometry.tileSize().wi
dth()); |
1098 int actualWidth = geometry.tileSize().width() + space; | 1098 int actualWidth = geometry.tileSize().width() + space; |
1099 | 1099 |
1100 if (space >= 0) { | 1100 if (space >= 0) { |
1101 computedXPosition = minimumValueForLength(Length(), availableWidth,
true); | 1101 computedXPosition = roundedMinimumValueForLength(Length(), available
Width); |
1102 geometry.setSpaceSize(IntSize(space, 0)); | 1102 geometry.setSpaceSize(IntSize(space, 0)); |
1103 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP
osition + left) % actualWidth : 0); | 1103 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP
osition + left) % actualWidth : 0); |
1104 } else { | 1104 } else { |
1105 backgroundRepeatX = NoRepeatFill; | 1105 backgroundRepeatX = NoRepeatFill; |
1106 } | 1106 } |
1107 } | 1107 } |
1108 if (backgroundRepeatX == NoRepeatFill) { | 1108 if (backgroundRepeatX == NoRepeatFill) { |
1109 int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWid
th - computedXPosition : computedXPosition; | 1109 int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWid
th - computedXPosition : computedXPosition; |
1110 geometry.setNoRepeatX(left + xOffset); | 1110 geometry.setNoRepeatX(left + xOffset); |
1111 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); | 1111 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); |
1112 } | 1112 } |
1113 | 1113 |
1114 if (backgroundRepeatY == RepeatFill) { | 1114 if (backgroundRepeatY == RepeatFill) { |
1115 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; | 1115 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; |
1116 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 1116 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
1117 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { | 1117 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { |
1118 int space = getSpace(positioningAreaSize.height(), geometry.tileSize().h
eight()); | 1118 int space = getSpace(positioningAreaSize.height(), geometry.tileSize().h
eight()); |
1119 int actualHeight = geometry.tileSize().height() + space; | 1119 int actualHeight = geometry.tileSize().height() + space; |
1120 | 1120 |
1121 if (space >= 0) { | 1121 if (space >= 0) { |
1122 computedYPosition = minimumValueForLength(Length(), availableHeight,
true); | 1122 computedYPosition = roundedMinimumValueForLength(Length(), available
Height); |
1123 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space)); | 1123 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space)); |
1124 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed
YPosition + top) % actualHeight : 0); | 1124 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed
YPosition + top) % actualHeight : 0); |
1125 } else { | 1125 } else { |
1126 backgroundRepeatY = NoRepeatFill; | 1126 backgroundRepeatY = NoRepeatFill; |
1127 } | 1127 } |
1128 } | 1128 } |
1129 if (backgroundRepeatY == NoRepeatFill) { | 1129 if (backgroundRepeatY == NoRepeatFill) { |
1130 int yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHe
ight - computedYPosition : computedYPosition; | 1130 int yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHe
ight - computedYPosition : computedYPosition; |
1131 geometry.setNoRepeatY(top + yOffset); | 1131 geometry.setNoRepeatY(top + yOffset); |
1132 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 1132 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2814 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2815 for (RenderObject* child = startChild; child && child != endChild; ) { | 2815 for (RenderObject* child = startChild; child && child != endChild; ) { |
2816 // Save our next sibling as moveChildTo will clear it. | 2816 // Save our next sibling as moveChildTo will clear it. |
2817 RenderObject* nextSibling = child->nextSibling(); | 2817 RenderObject* nextSibling = child->nextSibling(); |
2818 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2818 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2819 child = nextSibling; | 2819 child = nextSibling; |
2820 } | 2820 } |
2821 } | 2821 } |
2822 | 2822 |
2823 } // namespace WebCore | 2823 } // namespace WebCore |
OLD | NEW |