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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on RenderBoxes, yet the existing code | 110 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on RenderBoxes, yet the existing code |
111 // only works on RenderBlocks. If this change, this class should be shared with
other RenderBoxes. | 111 // only works on RenderBlocks. If this change, this class should be shared with
other RenderBoxes. |
112 class OverflowEventDispatcher { | 112 class OverflowEventDispatcher { |
113 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); | 113 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); |
114 public: | 114 public: |
115 OverflowEventDispatcher(const RenderBlock* block) | 115 OverflowEventDispatcher(const RenderBlock* block) |
116 : m_block(block) | 116 : m_block(block) |
117 , m_hadHorizontalLayoutOverflow(false) | 117 , m_hadHorizontalLayoutOverflow(false) |
118 , m_hadVerticalLayoutOverflow(false) | 118 , m_hadVerticalLayoutOverflow(false) |
119 { | 119 { |
120 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER
); | 120 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER)
; |
121 if (m_shouldDispatchEvent) { | 121 if (m_shouldDispatchEvent) { |
122 m_hadHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow
(); | 122 m_hadHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow
(); |
123 m_hadVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | 123 m_hadVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 ~OverflowEventDispatcher() | 127 ~OverflowEventDispatcher() |
128 { | 128 { |
129 if (!m_shouldDispatchEvent) | 129 if (!m_shouldDispatchEvent) |
130 return; | 130 return; |
131 | 131 |
132 bool hasHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow(
); | 132 bool hasHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow(
); |
133 bool hasVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | 133 bool hasVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); |
134 | 134 |
135 bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_
hadHorizontalLayoutOverflow; | 135 bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_
hadHorizontalLayoutOverflow; |
136 bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadV
erticalLayoutOverflow; | 136 bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadV
erticalLayoutOverflow; |
137 if (horizontalLayoutOverflowChanged || verticalLayoutOverflowChanged) { | 137 if (horizontalLayoutOverflowChanged || verticalLayoutOverflowChanged) { |
138 if (FrameView* frameView = m_block->document()->view()) | 138 if (FrameView* frameView = m_block->document().view()) |
139 frameView->scheduleEvent(OverflowEvent::create(horizontalLayoutO
verflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChanged, hasV
erticalLayoutOverflow), m_block->node()); | 139 frameView->scheduleEvent(OverflowEvent::create(horizontalLayoutO
verflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChanged, hasV
erticalLayoutOverflow), m_block->node()); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 private: | 143 private: |
144 const RenderBlock* m_block; | 144 const RenderBlock* m_block; |
145 bool m_shouldDispatchEvent; | 145 bool m_shouldDispatchEvent; |
146 bool m_hadHorizontalLayoutOverflow; | 146 bool m_hadHorizontalLayoutOverflow; |
147 bool m_hadVerticalLayoutOverflow; | 147 bool m_hadVerticalLayoutOverflow; |
148 }; | 148 }; |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 } | 954 } |
955 } while (!sawInline); | 955 } while (!sawInline); |
956 } | 956 } |
957 | 957 |
958 void RenderBlock::deleteLineBoxTree() | 958 void RenderBlock::deleteLineBoxTree() |
959 { | 959 { |
960 if (containsFloats()) | 960 if (containsFloats()) |
961 m_floatingObjects->clearLineBoxTreePointers(); | 961 m_floatingObjects->clearLineBoxTreePointers(); |
962 m_lineBoxes.deleteLineBoxTree(); | 962 m_lineBoxes.deleteLineBoxTree(); |
963 | 963 |
964 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 964 if (AXObjectCache* cache = document().existingAXObjectCache()) |
965 cache->recomputeIsIgnored(this); | 965 cache->recomputeIsIgnored(this); |
966 } | 966 } |
967 | 967 |
968 RootInlineBox* RenderBlock::createRootInlineBox() | 968 RootInlineBox* RenderBlock::createRootInlineBox() |
969 { | 969 { |
970 return new RootInlineBox(this); | 970 return new RootInlineBox(this); |
971 } | 971 } |
972 | 972 |
973 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() | 973 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() |
974 { | 974 { |
975 RootInlineBox* rootBox = createRootInlineBox(); | 975 RootInlineBox* rootBox = createRootInlineBox(); |
976 m_lineBoxes.appendLineBox(rootBox); | 976 m_lineBoxes.appendLineBox(rootBox); |
977 | 977 |
978 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine
Box() == rootBox) { | 978 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine
Box() == rootBox) { |
979 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 979 if (AXObjectCache* cache = document().existingAXObjectCache()) |
980 cache->recomputeIsIgnored(this); | 980 cache->recomputeIsIgnored(this); |
981 } | 981 } |
982 | 982 |
983 return rootBox; | 983 return rootBox; |
984 } | 984 } |
985 | 985 |
986 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) | 986 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) |
987 { | 987 { |
988 // makeChildrenNonInline takes a block whose children are *all* inline and i
t | 988 // makeChildrenNonInline takes a block whose children are *all* inline and i
t |
989 // makes sure that inline children are coalesced under anonymous | 989 // makes sure that inline children are coalesced under anonymous |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 // (d) have a min-height | 1291 // (d) have a min-height |
1292 // (e) have specified that one of our margins can't collapse using a CSS ext
ension | 1292 // (e) have specified that one of our margins can't collapse using a CSS ext
ension |
1293 if (logicalHeight() > 0 | 1293 if (logicalHeight() > 0 |
1294 || isTable() || borderAndPaddingLogicalHeight() | 1294 || isTable() || borderAndPaddingLogicalHeight() |
1295 || style()->logicalMinHeight().isPositive() | 1295 || style()->logicalMinHeight().isPositive() |
1296 || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterC
ollapse() == MSEPARATE) | 1296 || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterC
ollapse() == MSEPARATE) |
1297 return false; | 1297 return false; |
1298 | 1298 |
1299 Length logicalHeightLength = style()->logicalHeight(); | 1299 Length logicalHeightLength = style()->logicalHeight(); |
1300 bool hasAutoHeight = logicalHeightLength.isAuto(); | 1300 bool hasAutoHeight = logicalHeightLength.isAuto(); |
1301 if (logicalHeightLength.isPercent() && !document()->inQuirksMode()) { | 1301 if (logicalHeightLength.isPercent() && !document().inQuirksMode()) { |
1302 hasAutoHeight = true; | 1302 hasAutoHeight = true; |
1303 for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->
containingBlock()) { | 1303 for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->
containingBlock()) { |
1304 if (cb->style()->logicalHeight().isFixed() || cb->isTableCell()) | 1304 if (cb->style()->logicalHeight().isFixed() || cb->isTableCell()) |
1305 hasAutoHeight = false; | 1305 hasAutoHeight = false; |
1306 } | 1306 } |
1307 } | 1307 } |
1308 | 1308 |
1309 // If the height is 0 or auto, then whether or not we are a self-collapsing
block depends | 1309 // If the height is 0 or auto, then whether or not we are a self-collapsing
block depends |
1310 // on whether we have content that is all self-collapsing or not. | 1310 // on whether we have content that is all self-collapsing or not. |
1311 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.
isPercent()) && logicalHeightLength.isZero())) { | 1311 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.
isPercent()) && logicalHeightLength.isZero())) { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2030 |
2031 // See if the top margin is quirky. We only care if this child has | 2031 // See if the top margin is quirky. We only care if this child has |
2032 // margins that will collapse with us. | 2032 // margins that will collapse with us. |
2033 bool topQuirk = hasMarginBeforeQuirk(child); | 2033 bool topQuirk = hasMarginBeforeQuirk(child); |
2034 | 2034 |
2035 if (marginInfo.canCollapseWithMarginBefore()) { | 2035 if (marginInfo.canCollapseWithMarginBefore()) { |
2036 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { | 2036 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { |
2037 // This child is collapsing with the top of the | 2037 // This child is collapsing with the top of the |
2038 // block. If it has larger margin values, then we need to update | 2038 // block. If it has larger margin values, then we need to update |
2039 // our own maximal values. | 2039 // our own maximal values. |
2040 if (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !
topQuirk) | 2040 if (!document().inQuirksMode() || !marginInfo.quirkContainer() || !t
opQuirk) |
2041 setMaxMarginBeforeValues(max(posTop, maxPositiveMarginBefore()),
max(negTop, maxNegativeMarginBefore())); | 2041 setMaxMarginBeforeValues(max(posTop, maxPositiveMarginBefore()),
max(negTop, maxNegativeMarginBefore())); |
2042 | 2042 |
2043 // The minute any of the margins involved isn't a quirk, don't | 2043 // The minute any of the margins involved isn't a quirk, don't |
2044 // collapse it away, even if the margin is smaller (www.webreference
.com | 2044 // collapse it away, even if the margin is smaller (www.webreference
.com |
2045 // has an example of this, a <dt> with 0.8em author-specified inside | 2045 // has an example of this, a <dt> with 0.8em author-specified inside |
2046 // a <dl> inside a <td>. | 2046 // a <dl> inside a <td>. |
2047 if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTo
p - negTop)) { | 2047 if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTo
p - negTop)) { |
2048 setHasMarginBeforeQuirk(false); | 2048 setHasMarginBeforeQuirk(false); |
2049 marginInfo.setDeterminedMarginBeforeQuirk(true); | 2049 marginInfo.setDeterminedMarginBeforeQuirk(true); |
2050 } | 2050 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 if (mustSeparateMarginBeforeForChild(child)) { | 2099 if (mustSeparateMarginBeforeForChild(child)) { |
2100 ASSERT(!marginInfo.discardMargin() || (marginInfo.discardMargin() &&
!marginInfo.margin())); | 2100 ASSERT(!marginInfo.discardMargin() || (marginInfo.discardMargin() &&
!marginInfo.margin())); |
2101 // If we are at the before side of the block and we collapse, ignore
the computed margin | 2101 // If we are at the before side of the block and we collapse, ignore
the computed margin |
2102 // and just add the child margin to the container height. This will
correctly position | 2102 // and just add the child margin to the container height. This will
correctly position |
2103 // the child inside the container. | 2103 // the child inside the container. |
2104 LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore(
) ? marginInfo.margin() : LayoutUnit(0); | 2104 LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore(
) ? marginInfo.margin() : LayoutUnit(0); |
2105 setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForC
hild(child)); | 2105 setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForC
hild(child)); |
2106 logicalTop = logicalHeight(); | 2106 logicalTop = logicalHeight(); |
2107 } else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlo
ck() | 2107 } else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlo
ck() |
2108 || (!marginInfo.canCollapseMarginBeforeWithChildren() | 2108 || (!marginInfo.canCollapseMarginBeforeWithChildren() |
2109 && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !
marginInfo.hasMarginBeforeQuirk())))) { | 2109 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !m
arginInfo.hasMarginBeforeQuirk())))) { |
2110 // We're collapsing with a previous sibling's margins and not | 2110 // We're collapsing with a previous sibling's margins and not |
2111 // with the top of the block. | 2111 // with the top of the block. |
2112 setLogicalHeight(logicalHeight() + max(marginInfo.positiveMargin(),
posTop) - max(marginInfo.negativeMargin(), negTop)); | 2112 setLogicalHeight(logicalHeight() + max(marginInfo.positiveMargin(),
posTop) - max(marginInfo.negativeMargin(), negTop)); |
2113 logicalTop = logicalHeight(); | 2113 logicalTop = logicalHeight(); |
2114 } | 2114 } |
2115 | 2115 |
2116 marginInfo.setDiscardMargin(childDiscardMarginAfter); | 2116 marginInfo.setDiscardMargin(childDiscardMarginAfter); |
2117 | 2117 |
2118 if (!marginInfo.discardMargin()) { | 2118 if (!marginInfo.discardMargin()) { |
2119 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); | 2119 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 toRenderBlock(child)->addIntrudingFloats(this, logicalLeftOffsetForConte
nt(), logicalTop); | 2215 toRenderBlock(child)->addIntrudingFloats(this, logicalLeftOffsetForConte
nt(), logicalTop); |
2216 | 2216 |
2217 return logicalTop; | 2217 return logicalTop; |
2218 } | 2218 } |
2219 | 2219 |
2220 void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& pos
itiveMarginBefore, LayoutUnit& negativeMarginBefore, bool& discardMarginBefore)
const | 2220 void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& pos
itiveMarginBefore, LayoutUnit& negativeMarginBefore, bool& discardMarginBefore)
const |
2221 { | 2221 { |
2222 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. | 2222 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. |
2223 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. | 2223 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. |
2224 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 2224 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
2225 if ((document()->inQuirksMode() && hasMarginAfterQuirk(child) && (isTableCel
l() || isBody())) || child->style()->marginBeforeCollapse() == MSEPARATE) | 2225 if ((document().inQuirksMode() && hasMarginAfterQuirk(child) && (isTableCell
() || isBody())) || child->style()->marginBeforeCollapse() == MSEPARATE) |
2226 return; | 2226 return; |
2227 | 2227 |
2228 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. | 2228 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. |
2229 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 2229 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
2230 if (child->style()->marginBeforeCollapse() == MDISCARD) { | 2230 if (child->style()->marginBeforeCollapse() == MDISCARD) { |
2231 positiveMarginBefore = 0; | 2231 positiveMarginBefore = 0; |
2232 negativeMarginBefore = 0; | 2232 negativeMarginBefore = 0; |
2233 discardMarginBefore = true; | 2233 discardMarginBefore = true; |
2234 return; | 2234 return; |
2235 } | 2235 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 setHasMarginAfterQuirk(true); | 2392 setHasMarginAfterQuirk(true); |
2393 } | 2393 } |
2394 } | 2394 } |
2395 | 2395 |
2396 void RenderBlock::handleAfterSideOfBlock(LayoutUnit beforeSide, LayoutUnit after
Side, MarginInfo& marginInfo) | 2396 void RenderBlock::handleAfterSideOfBlock(LayoutUnit beforeSide, LayoutUnit after
Side, MarginInfo& marginInfo) |
2397 { | 2397 { |
2398 marginInfo.setAtAfterSideOfBlock(true); | 2398 marginInfo.setAtAfterSideOfBlock(true); |
2399 | 2399 |
2400 // If we can't collapse with children then go ahead and add in the bottom ma
rgin. | 2400 // If we can't collapse with children then go ahead and add in the bottom ma
rgin. |
2401 if (!marginInfo.discardMargin() && (!marginInfo.canCollapseWithMarginAfter()
&& !marginInfo.canCollapseWithMarginBefore() | 2401 if (!marginInfo.discardMargin() && (!marginInfo.canCollapseWithMarginAfter()
&& !marginInfo.canCollapseWithMarginBefore() |
2402 && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marg
inInfo.hasMarginAfterQuirk()))) | 2402 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !margi
nInfo.hasMarginAfterQuirk()))) |
2403 setLogicalHeight(logicalHeight() + marginInfo.margin()); | 2403 setLogicalHeight(logicalHeight() + marginInfo.margin()); |
2404 | 2404 |
2405 // Now add in our bottom border/padding. | 2405 // Now add in our bottom border/padding. |
2406 setLogicalHeight(logicalHeight() + afterSide); | 2406 setLogicalHeight(logicalHeight() + afterSide); |
2407 | 2407 |
2408 // Negative margins can cause our height to shrink below our minimal height
(border/padding). | 2408 // Negative margins can cause our height to shrink below our minimal height
(border/padding). |
2409 // If this happens, ensure that the computed height is increased to the mini
mal height. | 2409 // If this happens, ensure that the computed height is increased to the mini
mal height. |
2410 setLogicalHeight(max(logicalHeight(), beforeSide + afterSide)); | 2410 setLogicalHeight(max(logicalHeight(), beforeSide + afterSide)); |
2411 | 2411 |
2412 // Update our bottom collapsed margin info. | 2412 // Update our bottom collapsed margin info. |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 else | 3072 else |
3073 currLogicalTopOffset -= blockDelta; | 3073 currLogicalTopOffset -= blockDelta; |
3074 } | 3074 } |
3075 } | 3075 } |
3076 | 3076 |
3077 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 3077 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
3078 { | 3078 { |
3079 // Avoid painting descendants of the root element when stylesheets haven't l
oaded. This eliminates FOUC. | 3079 // Avoid painting descendants of the root element when stylesheets haven't l
oaded. This eliminates FOUC. |
3080 // It's ok not to draw, because later on, when all the stylesheets do load,
styleResolverChanged() on the Document | 3080 // It's ok not to draw, because later on, when all the stylesheets do load,
styleResolverChanged() on the Document |
3081 // will do a full repaint. | 3081 // will do a full repaint. |
3082 if (document()->didLayoutWithPendingStylesheets() && !isRenderView()) | 3082 if (document().didLayoutWithPendingStylesheets() && !isRenderView()) |
3083 return; | 3083 return; |
3084 | 3084 |
3085 if (childrenInline()) | 3085 if (childrenInline()) |
3086 m_lineBoxes.paint(this, paintInfo, paintOffset); | 3086 m_lineBoxes.paint(this, paintInfo, paintOffset); |
3087 else { | 3087 else { |
3088 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? Pai
ntPhaseOutline : paintInfo.phase; | 3088 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? Pai
ntPhaseOutline : paintInfo.phase; |
3089 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi
ldBlockBackground : newPhase; | 3089 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi
ldBlockBackground : newPhase; |
3090 | 3090 |
3091 // We don't paint our own background, but we do let the kids paint their
backgrounds. | 3091 // We don't paint our own background, but we do let the kids paint their
backgrounds. |
3092 PaintInfo paintInfoForChild(paintInfo); | 3092 PaintInfo paintInfoForChild(paintInfo); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3197 // 2. paint contents | 3197 // 2. paint contents |
3198 if (paintPhase != PaintPhaseSelfOutline) { | 3198 if (paintPhase != PaintPhaseSelfOutline) { |
3199 if (hasColumns()) | 3199 if (hasColumns()) |
3200 paintColumnContents(paintInfo, scrolledOffset); | 3200 paintColumnContents(paintInfo, scrolledOffset); |
3201 else | 3201 else |
3202 paintContents(paintInfo, scrolledOffset); | 3202 paintContents(paintInfo, scrolledOffset); |
3203 } | 3203 } |
3204 | 3204 |
3205 // 3. paint selection | 3205 // 3. paint selection |
3206 // FIXME: Make this work with multi column layouts. For now don't fill gaps
. | 3206 // FIXME: Make this work with multi column layouts. For now don't fill gaps
. |
3207 bool isPrinting = document()->printing(); | 3207 bool isPrinting = document().printing(); |
3208 if (!isPrinting && !hasColumns()) | 3208 if (!isPrinting && !hasColumns()) |
3209 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection
on lines and between blocks. | 3209 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection
on lines and between blocks. |
3210 | 3210 |
3211 // 4. paint floats. | 3211 // 4. paint floats. |
3212 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa
intPhase == PaintPhaseTextClip) { | 3212 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa
intPhase == PaintPhaseTextClip) { |
3213 if (hasColumns()) | 3213 if (hasColumns()) |
3214 paintColumnContents(paintInfo, scrolledOffset, true); | 3214 paintColumnContents(paintInfo, scrolledOffset, true); |
3215 else | 3215 else |
3216 paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelec
tion || paintPhase == PaintPhaseTextClip); | 3216 paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelec
tion || paintPhase == PaintPhaseTextClip); |
3217 } | 3217 } |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5177 if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstA
fterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTo
pWithLeading() | 5177 if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstA
fterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTo
pWithLeading() |
5178 || (!blocksAreFlipped && pointInLogicalContents.y() == nextR
ootBoxWithChildren->lineTopWithLeading()))) | 5178 || (!blocksAreFlipped && pointInLogicalContents.y() == nextR
ootBoxWithChildren->lineTopWithLeading()))) |
5179 continue; | 5179 continue; |
5180 } | 5180 } |
5181 closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLog
icalContents.x()); | 5181 closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLog
icalContents.x()); |
5182 if (closestBox) | 5182 if (closestBox) |
5183 break; | 5183 break; |
5184 } | 5184 } |
5185 } | 5185 } |
5186 | 5186 |
5187 bool moveCaretToBoundary = document()->frame()->editor().behavior().shouldMo
veCaretToHorizontalBoundaryWhenPastTopOrBottom(); | 5187 bool moveCaretToBoundary = document().frame()->editor().behavior().shouldMov
eCaretToHorizontalBoundaryWhenPastTopOrBottom(); |
5188 | 5188 |
5189 if (!moveCaretToBoundary && !closestBox && lastRootBoxWithChildren) { | 5189 if (!moveCaretToBoundary && !closestBox && lastRootBoxWithChildren) { |
5190 // y coordinate is below last root line box, pretend we hit it | 5190 // y coordinate is below last root line box, pretend we hit it |
5191 closestBox = lastRootBoxWithChildren->closestLeafChildForLogicalLeftPosi
tion(pointInLogicalContents.x()); | 5191 closestBox = lastRootBoxWithChildren->closestLeafChildForLogicalLeftPosi
tion(pointInLogicalContents.x()); |
5192 } | 5192 } |
5193 | 5193 |
5194 if (closestBox) { | 5194 if (closestBox) { |
5195 if (moveCaretToBoundary) { | 5195 if (moveCaretToBoundary) { |
5196 LayoutUnit firstRootBoxWithChildrenTop = min<LayoutUnit>(firstRootBo
xWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); | 5196 LayoutUnit firstRootBoxWithChildrenTop = min<LayoutUnit>(firstRootBo
xWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); |
5197 if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop | 5197 if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5307 | 5307 |
5308 int RenderBlock::columnGap() const | 5308 int RenderBlock::columnGap() const |
5309 { | 5309 { |
5310 if (style()->hasNormalColumnGap()) | 5310 if (style()->hasNormalColumnGap()) |
5311 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. | 5311 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. |
5312 return static_cast<int>(style()->columnGap()); | 5312 return static_cast<int>(style()->columnGap()); |
5313 } | 5313 } |
5314 | 5314 |
5315 void RenderBlock::calcColumnWidth() | 5315 void RenderBlock::calcColumnWidth() |
5316 { | 5316 { |
5317 if (document()->regionBasedColumnsEnabled()) | 5317 if (document().regionBasedColumnsEnabled()) |
5318 return; | 5318 return; |
5319 | 5319 |
5320 // Calculate our column width and column count. | 5320 // Calculate our column width and column count. |
5321 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli
ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 | 5321 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli
ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 |
5322 unsigned desiredColumnCount = 1; | 5322 unsigned desiredColumnCount = 1; |
5323 LayoutUnit desiredColumnWidth = contentLogicalWidth(); | 5323 LayoutUnit desiredColumnWidth = contentLogicalWidth(); |
5324 | 5324 |
5325 // For now, we don't support multi-column layouts when printing, since we ha
ve to do a lot of work for proper pagination. | 5325 // For now, we don't support multi-column layouts when printing, since we ha
ve to do a lot of work for proper pagination. |
5326 if (document()->paginated() || (style()->hasAutoColumnCount() && style()->ha
sAutoColumnWidth()) || !style()->hasInlineColumnAxis()) { | 5326 if (document().paginated() || (style()->hasAutoColumnCount() && style()->has
AutoColumnWidth()) || !style()->hasInlineColumnAxis()) { |
5327 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); | 5327 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); |
5328 return; | 5328 return; |
5329 } | 5329 } |
5330 | 5330 |
5331 LayoutUnit availWidth = desiredColumnWidth; | 5331 LayoutUnit availWidth = desiredColumnWidth; |
5332 LayoutUnit colGap = columnGap(); | 5332 LayoutUnit colGap = columnGap(); |
5333 LayoutUnit colWidth = max<LayoutUnit>(1, LayoutUnit(style()->columnWidth()))
; | 5333 LayoutUnit colWidth = max<LayoutUnit>(1, LayoutUnit(style()->columnWidth()))
; |
5334 int colCount = max<int>(1, style()->columnCount()); | 5334 int colCount = max<int>(1, style()->columnCount()); |
5335 | 5335 |
5336 if (style()->hasAutoColumnWidth() && !style()->hasAutoColumnCount()) { | 5336 if (style()->hasAutoColumnWidth() && !style()->hasAutoColumnCount()) { |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5952 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); | 5952 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); |
5953 | 5953 |
5954 // If we are at the start of a line, we want to ignore all white-space. | 5954 // If we are at the start of a line, we want to ignore all white-space. |
5955 // Also strip spaces if we previously had text that ended in a trailing spac
e. | 5955 // Also strip spaces if we previously had text that ended in a trailing spac
e. |
5956 bool stripFrontSpaces = true; | 5956 bool stripFrontSpaces = true; |
5957 RenderObject* trailingSpaceChild = 0; | 5957 RenderObject* trailingSpaceChild = 0; |
5958 | 5958 |
5959 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under | 5959 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under |
5960 // very specific cirucumstances (in order to match common WinIE renderings). | 5960 // very specific cirucumstances (in order to match common WinIE renderings). |
5961 // Not supporting the quirk has caused us to mis-render some real sites. (Se
e Bugzilla 10517.) | 5961 // Not supporting the quirk has caused us to mis-render some real sites. (Se
e Bugzilla 10517.) |
5962 bool allowImagesToBreak = !document()->inQuirksMode() || !isTableCell() || !
styleToUse->logicalWidth().isIntrinsicOrAuto(); | 5962 bool allowImagesToBreak = !document().inQuirksMode() || !isTableCell() || !s
tyleToUse->logicalWidth().isIntrinsicOrAuto(); |
5963 | 5963 |
5964 bool autoWrap, oldAutoWrap; | 5964 bool autoWrap, oldAutoWrap; |
5965 autoWrap = oldAutoWrap = styleToUse->autoWrap(); | 5965 autoWrap = oldAutoWrap = styleToUse->autoWrap(); |
5966 | 5966 |
5967 InlineMinMaxIterator childIterator(this); | 5967 InlineMinMaxIterator childIterator(this); |
5968 | 5968 |
5969 // Only gets added to the max preffered width once. | 5969 // Only gets added to the max preffered width once. |
5970 bool addedTextIndent = false; | 5970 bool addedTextIndent = false; |
5971 // Signals the text indent was more negative than the min preferred width | 5971 // Signals the text indent was more negative than the min preferred width |
5972 bool hasRemainingNegativeTextIndent = false; | 5972 bool hasRemainingNegativeTextIndent = false; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6355 | 6355 |
6356 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const | 6356 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const |
6357 { | 6357 { |
6358 // Inline blocks are replaced elements. Otherwise, just pass off to | 6358 // Inline blocks are replaced elements. Otherwise, just pass off to |
6359 // the base class. If we're being queried as though we're the root line | 6359 // the base class. If we're being queried as though we're the root line |
6360 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 6360 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
6361 // just like a block. | 6361 // just like a block. |
6362 if (isReplaced() && linePositionMode == PositionOnContainingLine) | 6362 if (isReplaced() && linePositionMode == PositionOnContainingLine) |
6363 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 6363 return RenderBox::lineHeight(firstLine, direction, linePositionMode); |
6364 | 6364 |
6365 if (firstLine && document()->styleSheetCollections()->usesFirstLineRules())
{ | 6365 if (firstLine && document().styleSheetCollections()->usesFirstLineRules()) { |
6366 RenderStyle* s = style(firstLine); | 6366 RenderStyle* s = style(firstLine); |
6367 if (s != style()) | 6367 if (s != style()) |
6368 return s->computedLineHeight(view()); | 6368 return s->computedLineHeight(view()); |
6369 } | 6369 } |
6370 | 6370 |
6371 if (m_lineHeight == -1) | 6371 if (m_lineHeight == -1) |
6372 m_lineHeight = style()->computedLineHeight(view()); | 6372 m_lineHeight = style()->computedLineHeight(view()); |
6373 | 6373 |
6374 return m_lineHeight; | 6374 return m_lineHeight; |
6375 } | 6375 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6575 return 0; | 6575 return 0; |
6576 } | 6576 } |
6577 | 6577 |
6578 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) | 6578 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) |
6579 { | 6579 { |
6580 RenderObject* firstLetter = currentChild->parent(); | 6580 RenderObject* firstLetter = currentChild->parent(); |
6581 RenderObject* firstLetterContainer = firstLetter->parent(); | 6581 RenderObject* firstLetterContainer = firstLetter->parent(); |
6582 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); | 6582 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); |
6583 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); | 6583 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); |
6584 | 6584 |
6585 if (Node::diff(firstLetter->style(), pseudoStyle, document()) == Node::Reatt
ach) { | 6585 if (Node::diff(firstLetter->style(), pseudoStyle, &document()) == Node::Reat
tach) { |
6586 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. | 6586 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. |
6587 RenderObject* newFirstLetter; | 6587 RenderObject* newFirstLetter; |
6588 if (pseudoStyle->display() == INLINE) | 6588 if (pseudoStyle->display() == INLINE) |
6589 newFirstLetter = RenderInline::createAnonymous(document()); | 6589 newFirstLetter = RenderInline::createAnonymous(&document()); |
6590 else | 6590 else |
6591 newFirstLetter = RenderBlock::createAnonymous(document()); | 6591 newFirstLetter = RenderBlock::createAnonymous(&document()); |
6592 newFirstLetter->setStyle(pseudoStyle); | 6592 newFirstLetter->setStyle(pseudoStyle); |
6593 | 6593 |
6594 // Move the first letter into the new renderer. | 6594 // Move the first letter into the new renderer. |
6595 LayoutStateDisabler layoutStateDisabler(view()); | 6595 LayoutStateDisabler layoutStateDisabler(view()); |
6596 while (RenderObject* child = firstLetter->firstChild()) { | 6596 while (RenderObject* child = firstLetter->firstChild()) { |
6597 if (child->isText()) | 6597 if (child->isText()) |
6598 toRenderText(child)->removeAndDestroyTextBoxes(); | 6598 toRenderText(child)->removeAndDestroyTextBoxes(); |
6599 firstLetter->removeChild(child); | 6599 firstLetter->removeChild(child); |
6600 newFirstLetter->addChild(child, 0); | 6600 newFirstLetter->addChild(child, 0); |
6601 } | 6601 } |
(...skipping 23 matching lines...) Expand all Loading... |
6625 genChild->setStyle(pseudoStyle); | 6625 genChild->setStyle(pseudoStyle); |
6626 } | 6626 } |
6627 } | 6627 } |
6628 | 6628 |
6629 void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend
erObject* currentChild) | 6629 void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend
erObject* currentChild) |
6630 { | 6630 { |
6631 RenderObject* firstLetterContainer = currentChild->parent(); | 6631 RenderObject* firstLetterContainer = currentChild->parent(); |
6632 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); | 6632 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); |
6633 RenderObject* firstLetter = 0; | 6633 RenderObject* firstLetter = 0; |
6634 if (pseudoStyle->display() == INLINE) | 6634 if (pseudoStyle->display() == INLINE) |
6635 firstLetter = RenderInline::createAnonymous(document()); | 6635 firstLetter = RenderInline::createAnonymous(&document()); |
6636 else | 6636 else |
6637 firstLetter = RenderBlock::createAnonymous(document()); | 6637 firstLetter = RenderBlock::createAnonymous(&document()); |
6638 firstLetter->setStyle(pseudoStyle); | 6638 firstLetter->setStyle(pseudoStyle); |
6639 firstLetterContainer->addChild(firstLetter, currentChild); | 6639 firstLetterContainer->addChild(firstLetter, currentChild); |
6640 | 6640 |
6641 RenderText* textObj = toRenderText(currentChild); | 6641 RenderText* textObj = toRenderText(currentChild); |
6642 | 6642 |
6643 // The original string is going to be either a generated content string or a
DOM node's | 6643 // The original string is going to be either a generated content string or a
DOM node's |
6644 // string. We want the original string before it got transformed in case fi
rst-letter has | 6644 // string. We want the original string before it got transformed in case fi
rst-letter has |
6645 // no text-transform or a different text-transform applied to it. | 6645 // no text-transform or a different text-transform applied to it. |
6646 RefPtr<StringImpl> oldText = textObj->originalText(); | 6646 RefPtr<StringImpl> oldText = textObj->originalText(); |
6647 ASSERT(oldText); | 6647 ASSERT(oldText); |
(...skipping 16 matching lines...) Expand all Loading... |
6664 if (!shouldSkipForFirstLetter(c)) | 6664 if (!shouldSkipForFirstLetter(c)) |
6665 break; | 6665 break; |
6666 | 6666 |
6667 if (isPunctuationForFirstLetter(c)) | 6667 if (isPunctuationForFirstLetter(c)) |
6668 length = scanLength + 1; | 6668 length = scanLength + 1; |
6669 } | 6669 } |
6670 | 6670 |
6671 // Construct a text fragment for the text after the first letter. | 6671 // Construct a text fragment for the text after the first letter. |
6672 // This text fragment might be empty. | 6672 // This text fragment might be empty. |
6673 RenderTextFragment* remainingText = | 6673 RenderTextFragment* remainingText = |
6674 new RenderTextFragment(textObj->node() ? textObj->node() : textObj->
document(), oldText.get(), length, oldText->length() - length); | 6674 new RenderTextFragment(textObj->node() ? textObj->node() : &textObj-
>document(), oldText.get(), length, oldText->length() - length); |
6675 remainingText->setStyle(textObj->style()); | 6675 remainingText->setStyle(textObj->style()); |
6676 if (remainingText->node()) | 6676 if (remainingText->node()) |
6677 remainingText->node()->setRenderer(remainingText); | 6677 remainingText->node()->setRenderer(remainingText); |
6678 | 6678 |
6679 firstLetterContainer->addChild(remainingText, textObj); | 6679 firstLetterContainer->addChild(remainingText, textObj); |
6680 firstLetterContainer->removeChild(textObj); | 6680 firstLetterContainer->removeChild(textObj); |
6681 remainingText->setFirstLetter(firstLetter); | 6681 remainingText->setFirstLetter(firstLetter); |
6682 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini
ngText); | 6682 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini
ngText); |
6683 | 6683 |
6684 // construct text fragment for the first letter | 6684 // construct text fragment for the first letter |
6685 RenderTextFragment* letter = | 6685 RenderTextFragment* letter = |
6686 new RenderTextFragment(remainingText->node() ? remainingText->node()
: remainingText->document(), oldText.get(), 0, length); | 6686 new RenderTextFragment(remainingText->node() ? remainingText->node()
: &remainingText->document(), oldText.get(), 0, length); |
6687 letter->setStyle(pseudoStyle); | 6687 letter->setStyle(pseudoStyle); |
6688 firstLetter->addChild(letter); | 6688 firstLetter->addChild(letter); |
6689 | 6689 |
6690 textObj->destroy(); | 6690 textObj->destroy(); |
6691 } | 6691 } |
6692 } | 6692 } |
6693 | 6693 |
6694 void RenderBlock::updateFirstLetter() | 6694 void RenderBlock::updateFirstLetter() |
6695 { | 6695 { |
6696 if (!document()->styleSheetCollections()->usesFirstLetterRules()) | 6696 if (!document().styleSheetCollections()->usesFirstLetterRules()) |
6697 return; | 6697 return; |
6698 // Don't recur | 6698 // Don't recur |
6699 if (style()->styleType() == FIRST_LETTER) | 6699 if (style()->styleType() == FIRST_LETTER) |
6700 return; | 6700 return; |
6701 | 6701 |
6702 // FIXME: We need to destroy the first-letter object if it is no longer the
first child. Need to find | 6702 // FIXME: We need to destroy the first-letter object if it is no longer the
first child. Need to find |
6703 // an efficient way to check for that situation though before implementing a
nything. | 6703 // an efficient way to check for that situation though before implementing a
nything. |
6704 RenderObject* firstLetterBlock = findFirstLetterBlock(this); | 6704 RenderObject* firstLetterBlock = findFirstLetterBlock(this); |
6705 if (!firstLetterBlock) | 6705 if (!firstLetterBlock) |
6706 return; | 6706 return; |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7978 return constructTextRunInternal(context, font, string.characters16(), length
, style, expansion, flags); | 7978 return constructTextRunInternal(context, font, string.characters16(), length
, style, expansion, flags); |
7979 } | 7979 } |
7980 | 7980 |
7981 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay display) | 7981 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay display) |
7982 { | 7982 { |
7983 // FIXME: Do we need to convert all our inline displays to block-type in the
anonymous logic ? | 7983 // FIXME: Do we need to convert all our inline displays to block-type in the
anonymous logic ? |
7984 EDisplay newDisplay; | 7984 EDisplay newDisplay; |
7985 RenderBlock* newBox = 0; | 7985 RenderBlock* newBox = 0; |
7986 if (display == BOX || display == INLINE_BOX) { | 7986 if (display == BOX || display == INLINE_BOX) { |
7987 // FIXME: Remove this case once we have eliminated all internal users of
old flexbox | 7987 // FIXME: Remove this case once we have eliminated all internal users of
old flexbox |
7988 newBox = RenderDeprecatedFlexibleBox::createAnonymous(parent->document()
); | 7988 newBox = RenderDeprecatedFlexibleBox::createAnonymous(&parent->document(
)); |
7989 newDisplay = BOX; | 7989 newDisplay = BOX; |
7990 } else if (display == FLEX || display == INLINE_FLEX) { | 7990 } else if (display == FLEX || display == INLINE_FLEX) { |
7991 newBox = RenderFlexibleBox::createAnonymous(parent->document()); | 7991 newBox = RenderFlexibleBox::createAnonymous(&parent->document()); |
7992 newDisplay = FLEX; | 7992 newDisplay = FLEX; |
7993 } else { | 7993 } else { |
7994 newBox = RenderBlock::createAnonymous(parent->document()); | 7994 newBox = RenderBlock::createAnonymous(&parent->document()); |
7995 newDisplay = BLOCK; | 7995 newDisplay = BLOCK; |
7996 } | 7996 } |
7997 | 7997 |
7998 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), newDisplay); | 7998 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), newDisplay); |
7999 newBox->setStyle(newStyle.release()); | 7999 newBox->setStyle(newStyle.release()); |
8000 return newBox; | 8000 return newBox; |
8001 } | 8001 } |
8002 | 8002 |
8003 RenderBlock* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderO
bject* parent) | 8003 RenderBlock* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderO
bject* parent) |
8004 { | 8004 { |
8005 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); | 8005 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); |
8006 newStyle->inheritColumnPropertiesFrom(parent->style()); | 8006 newStyle->inheritColumnPropertiesFrom(parent->style()); |
8007 | 8007 |
8008 RenderBlock* newBox = RenderBlock::createAnonymous(parent->document()); | 8008 RenderBlock* newBox = RenderBlock::createAnonymous(&parent->document()); |
8009 newBox->setStyle(newStyle.release()); | 8009 newBox->setStyle(newStyle.release()); |
8010 return newBox; | 8010 return newBox; |
8011 } | 8011 } |
8012 | 8012 |
8013 RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const Rend
erObject* parent) | 8013 RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const Rend
erObject* parent) |
8014 { | 8014 { |
8015 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); | 8015 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); |
8016 newStyle->setColumnSpan(ColumnSpanAll); | 8016 newStyle->setColumnSpan(ColumnSpanAll); |
8017 | 8017 |
8018 RenderBlock* newBox = RenderBlock::createAnonymous(parent->document()); | 8018 RenderBlock* newBox = RenderBlock::createAnonymous(&parent->document()); |
8019 newBox->setStyle(newStyle.release()); | 8019 newBox->setStyle(newStyle.release()); |
8020 return newBox; | 8020 return newBox; |
8021 } | 8021 } |
8022 | 8022 |
8023 #ifndef NDEBUG | 8023 #ifndef NDEBUG |
8024 void RenderBlock::checkPositionedObjectsNeedLayout() | 8024 void RenderBlock::checkPositionedObjectsNeedLayout() |
8025 { | 8025 { |
8026 if (!gPositionedDescendantsMap) | 8026 if (!gPositionedDescendantsMap) |
8027 return; | 8027 return; |
8028 | 8028 |
8029 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { | 8029 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { |
8030 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); | 8030 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); |
8031 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { | 8031 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { |
8032 RenderBox* currBox = *it; | 8032 RenderBox* currBox = *it; |
8033 ASSERT(!currBox->needsLayout()); | 8033 ASSERT(!currBox->needsLayout()); |
8034 } | 8034 } |
8035 } | 8035 } |
8036 } | 8036 } |
8037 | 8037 |
8038 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 8038 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
8039 { | 8039 { |
8040 showRenderObject(); | 8040 showRenderObject(); |
8041 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 8041 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
8042 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 8042 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
8043 } | 8043 } |
8044 | 8044 |
8045 #endif | 8045 #endif |
8046 | 8046 |
8047 } // namespace WebCore | 8047 } // namespace WebCore |
OLD | NEW |