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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout) | 201 void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout) |
202 { | 202 { |
203 // Once we have been tainted once, just assume it will happen again. This wa
y effects like hover highlighting that change the | 203 // Once we have been tainted once, just assume it will happen again. This wa
y effects like hover highlighting that change the |
204 // background color will only cause a layout on the first rollover. | 204 // background color will only cause a layout on the first rollover. |
205 if (m_alwaysCreateLineBoxes) | 205 if (m_alwaysCreateLineBoxes) |
206 return; | 206 return; |
207 | 207 |
208 RenderStyle* parentStyle = parent()->style(); | 208 RenderStyle* parentStyle = parent()->style(); |
209 RenderInline* parentRenderInline = parent()->isRenderInline() ? toRenderInli
ne(parent()) : 0; | 209 RenderInline* parentRenderInline = parent()->isRenderInline() ? toRenderInli
ne(parent()) : 0; |
210 bool checkFonts = document()->inNoQuirksMode(); | 210 bool checkFonts = document().inNoQuirksMode(); |
211 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 211 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
212 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa
ysCreateLineBoxes()) | 212 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa
ysCreateLineBoxes()) |
213 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE) | 213 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE) |
214 || style()->verticalAlign() != BASELINE | 214 || style()->verticalAlign() != BASELINE |
215 || style()->textEmphasisMark() != TextEmphasisMarkNone | 215 || style()->textEmphasisMark() != TextEmphasisMarkNone |
216 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent
DescentAndLineGap(style()->font().fontMetrics()) | 216 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent
DescentAndLineGap(style()->font().fontMetrics()) |
217 || parentStyle->lineHeight() != style()->lineHeight())) | 217 || parentStyle->lineHeight() != style()->lineHeight())) |
218 || (flowThread && flowThread->hasRegionsWithStyling()); | 218 || (flowThread && flowThread->hasRegionsWithStyling()); |
219 | 219 |
220 if (!alwaysCreateLineBoxes && checkFonts && document()->styleSheetCollection
s()->usesFirstLineRules()) { | 220 if (!alwaysCreateLineBoxes && checkFonts && document().styleSheetCollections
()->usesFirstLineRules()) { |
221 // Have to check the first line style as well. | 221 // Have to check the first line style as well. |
222 parentStyle = parent()->style(true); | 222 parentStyle = parent()->style(true); |
223 RenderStyle* childStyle = style(true); | 223 RenderStyle* childStyle = style(true); |
224 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA
scentDescentAndLineGap(childStyle->font().fontMetrics()) | 224 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA
scentDescentAndLineGap(childStyle->font().fontMetrics()) |
225 || childStyle->verticalAlign() != BASELINE | 225 || childStyle->verticalAlign() != BASELINE |
226 || parentStyle->lineHeight() != childStyle->lineHeight(); | 226 || parentStyle->lineHeight() != childStyle->lineHeight(); |
227 } | 227 } |
228 | 228 |
229 if (alwaysCreateLineBoxes) { | 229 if (alwaysCreateLineBoxes) { |
230 if (!fullLayout) | 230 if (!fullLayout) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // inline into continuations. This involves creating an anonymous block
box to hold | 307 // inline into continuations. This involves creating an anonymous block
box to hold |
308 // |newChild|. We then make that block box a continuation of this inlin
e. We take all of | 308 // |newChild|. We then make that block box a continuation of this inlin
e. We take all of |
309 // the children after |beforeChild| and put them in a clone of this obje
ct. | 309 // the children after |beforeChild| and put them in a clone of this obje
ct. |
310 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp
lay(style(), BLOCK); | 310 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp
lay(style(), BLOCK); |
311 | 311 |
312 // If inside an inline affected by in-flow positioning the block needs t
o be affected by it too. | 312 // If inside an inline affected by in-flow positioning the block needs t
o be affected by it too. |
313 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. | 313 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. |
314 if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) | 314 if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) |
315 newStyle->setPosition(positionedAncestor->style()->position()); | 315 newStyle->setPosition(positionedAncestor->style()->position()); |
316 | 316 |
317 RenderBlock* newBox = RenderBlock::createAnonymous(document()); | 317 RenderBlock* newBox = RenderBlock::createAnonymous(&document()); |
318 newBox->setStyle(newStyle.release()); | 318 newBox->setStyle(newStyle.release()); |
319 RenderBoxModelObject* oldContinuation = continuation(); | 319 RenderBoxModelObject* oldContinuation = continuation(); |
320 setContinuation(newBox); | 320 setContinuation(newBox); |
321 | 321 |
322 splitFlow(beforeChild, newBox, newChild, oldContinuation); | 322 splitFlow(beforeChild, newBox, newChild, oldContinuation); |
323 return; | 323 return; |
324 } | 324 } |
325 | 325 |
326 RenderBoxModelObject::addChild(newChild, beforeChild); | 326 RenderBoxModelObject::addChild(newChild, beforeChild); |
327 | 327 |
(...skipping 14 matching lines...) Expand all Loading... |
342 { | 342 { |
343 // Create a clone of this inline. | 343 // Create a clone of this inline. |
344 RenderInline* cloneInline = clone(); | 344 RenderInline* cloneInline = clone(); |
345 cloneInline->setContinuation(oldCont); | 345 cloneInline->setContinuation(oldCont); |
346 | 346 |
347 // If we're splitting the inline containing the fullscreened element, | 347 // If we're splitting the inline containing the fullscreened element, |
348 // |beforeChild| may be the renderer for the fullscreened element. However, | 348 // |beforeChild| may be the renderer for the fullscreened element. However, |
349 // that renderer is wrapped in a RenderFullScreen, so |this| is not its | 349 // that renderer is wrapped in a RenderFullScreen, so |this| is not its |
350 // parent. Since the splitting logic expects |this| to be the parent, set | 350 // parent. Since the splitting logic expects |this| to be the parent, set |
351 // |beforeChild| to be the RenderFullScreen. | 351 // |beforeChild| to be the RenderFullScreen. |
352 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(document())) { | 352 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(&document())) { |
353 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); | 353 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); |
354 if (fullScreenElement && beforeChild && beforeChild->node() == fullScree
nElement) | 354 if (fullScreenElement && beforeChild && beforeChild->node() == fullScree
nElement) |
355 beforeChild = fullscreen->fullScreenRenderer(); | 355 beforeChild = fullscreen->fullScreenRenderer(); |
356 } | 356 } |
357 | 357 |
358 // Now take all of the children from beforeChild to the end and remove | 358 // Now take all of the children from beforeChild to the end and remove |
359 // them from |this| and place them in the clone. | 359 // them from |this| and place them in the clone. |
360 RenderObject* o = beforeChild; | 360 RenderObject* o = beforeChild; |
361 while (o) { | 361 while (o) { |
362 RenderObject* tmp = o; | 362 RenderObject* tmp = o; |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() | 1281 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() |
1282 { | 1282 { |
1283 setAlwaysCreateLineBoxes(); | 1283 setAlwaysCreateLineBoxes(); |
1284 InlineFlowBox* flowBox = createInlineFlowBox(); | 1284 InlineFlowBox* flowBox = createInlineFlowBox(); |
1285 m_lineBoxes.appendLineBox(flowBox); | 1285 m_lineBoxes.appendLineBox(flowBox); |
1286 return flowBox; | 1286 return flowBox; |
1287 } | 1287 } |
1288 | 1288 |
1289 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio
n*/, LinePositionMode /*linePositionMode*/) const | 1289 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio
n*/, LinePositionMode /*linePositionMode*/) const |
1290 { | 1290 { |
1291 if (firstLine && document()->styleSheetCollections()->usesFirstLineRules())
{ | 1291 if (firstLine && document().styleSheetCollections()->usesFirstLineRules()) { |
1292 RenderStyle* s = style(firstLine); | 1292 RenderStyle* s = style(firstLine); |
1293 if (s != style()) | 1293 if (s != style()) |
1294 return s->computedLineHeight(view()); | 1294 return s->computedLineHeight(view()); |
1295 } | 1295 } |
1296 | 1296 |
1297 return style()->computedLineHeight(view()); | 1297 return style()->computedLineHeight(view()); |
1298 } | 1298 } |
1299 | 1299 |
1300 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li
neDirectionMode direction, LinePositionMode linePositionMode) const | 1300 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li
neDirectionMode direction, LinePositionMode linePositionMode) const |
1301 { | 1301 { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 container = this; | 1577 container = this; |
1578 | 1578 |
1579 FloatPoint absPos = container->localToAbsolute(); | 1579 FloatPoint absPos = container->localToAbsolute(); |
1580 region.bounds.setX(absPos.x() + region.bounds.x()); | 1580 region.bounds.setX(absPos.x() + region.bounds.x()); |
1581 region.bounds.setY(absPos.y() + region.bounds.y()); | 1581 region.bounds.setY(absPos.y() + region.bounds.y()); |
1582 | 1582 |
1583 regions.append(region); | 1583 regions.append(region); |
1584 } | 1584 } |
1585 | 1585 |
1586 } // namespace WebCore | 1586 } // namespace WebCore |
OLD | NEW |