| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 using namespace WTF; | 49 using namespace WTF; |
| 50 using namespace Unicode; | 50 using namespace Unicode; |
| 51 | 51 |
| 52 namespace WebCore { | 52 namespace WebCore { |
| 53 | 53 |
| 54 // We don't let our line box tree for a single line get any deeper than this. | 54 // We don't let our line box tree for a single line get any deeper than this. |
| 55 const unsigned cMaxLineDepth = 200; | 55 const unsigned cMaxLineDepth = 200; |
| 56 | 56 |
| 57 static LayoutUnit logicalHeightForLine(const RenderBlock* block, bool isFirstLin
e, LayoutUnit replacedHeight = 0) | 57 static LayoutUnit logicalHeightForLine(const RenderBlock* block, bool isFirstLin
e, LayoutUnit replacedHeight = 0) |
| 58 { | 58 { |
| 59 if (!block->document()->inNoQuirksMode() && replacedHeight) | 59 if (!block->document().inNoQuirksMode() && replacedHeight) |
| 60 return replacedHeight; | 60 return replacedHeight; |
| 61 | 61 |
| 62 if (!(block->style(isFirstLine)->lineBoxContain() & LineBoxContainBlock)) | 62 if (!(block->style(isFirstLine)->lineBoxContain() & LineBoxContainBlock)) |
| 63 return 0; | 63 return 0; |
| 64 | 64 |
| 65 return max<LayoutUnit>(replacedHeight, block->lineHeight(isFirstLine, block-
>isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLi
neBoxes)); | 65 return max<LayoutUnit>(replacedHeight, block->lineHeight(isFirstLine, block-
>isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLi
neBoxes)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const | 68 ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const |
| 69 { | 69 { |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRo
otLineBox, bool isOnlyRun = false) | 522 static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRo
otLineBox, bool isOnlyRun = false) |
| 523 { | 523 { |
| 524 if (isRootLineBox) | 524 if (isRootLineBox) |
| 525 return toRenderBlock(obj)->createAndAppendRootInlineBox(); | 525 return toRenderBlock(obj)->createAndAppendRootInlineBox(); |
| 526 | 526 |
| 527 if (obj->isText()) { | 527 if (obj->isText()) { |
| 528 InlineTextBox* textBox = toRenderText(obj)->createInlineTextBox(); | 528 InlineTextBox* textBox = toRenderText(obj)->createInlineTextBox(); |
| 529 // We only treat a box as text for a <br> if we are on a line by ourself
or in strict mode | 529 // We only treat a box as text for a <br> if we are on a line by ourself
or in strict mode |
| 530 // (Note the use of strict mode. In "almost strict" mode, we don't trea
t the box for <br> as text.) | 530 // (Note the use of strict mode. In "almost strict" mode, we don't trea
t the box for <br> as text.) |
| 531 if (obj->isBR()) | 531 if (obj->isBR()) |
| 532 textBox->setIsText(isOnlyRun || obj->document()->inNoQuirksMode()); | 532 textBox->setIsText(isOnlyRun || obj->document().inNoQuirksMode()); |
| 533 return textBox; | 533 return textBox; |
| 534 } | 534 } |
| 535 | 535 |
| 536 if (obj->isBox()) | 536 if (obj->isBox()) |
| 537 return toRenderBox(obj)->createInlineBox(); | 537 return toRenderBox(obj)->createInlineBox(); |
| 538 | 538 |
| 539 return toRenderInline(obj)->createAndAppendInlineFlowBox(); | 539 return toRenderInline(obj)->createAndAppendInlineFlowBox(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 // FIXME: Don't let counters mark themselves as needing pref width recalcs durin
g layout | 542 // FIXME: Don't let counters mark themselves as needing pref width recalcs durin
g layout |
| (...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 // If a space (U+0020) at the beginning of a line has 'white-space' set to '
normal', 'nowrap', or 'pre-line', it is removed. | 2469 // If a space (U+0020) at the beginning of a line has 'white-space' set to '
normal', 'nowrap', or 'pre-line', it is removed. |
| 2470 // If a space (U+0020) at the end of a line has 'white-space' set to 'normal
', 'nowrap', or 'pre-line', it is also removed. | 2470 // If a space (U+0020) at the end of a line has 'white-space' set to 'normal
', 'nowrap', or 'pre-line', it is also removed. |
| 2471 // If spaces (U+0020) or tabs (U+0009) at the end of a line have 'white-spac
e' set to 'pre-wrap', UAs may visually collapse them. | 2471 // If spaces (U+0020) or tabs (U+0009) at the end of a line have 'white-spac
e' set to 'pre-wrap', UAs may visually collapse them. |
| 2472 return style->collapseWhiteSpace() | 2472 return style->collapseWhiteSpace() |
| 2473 || (whitespacePosition == TrailingWhitespace && style->whiteSpace() == P
RE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); | 2473 || (whitespacePosition == TrailingWhitespace && style->whiteSpace() == P
RE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); |
| 2474 } | 2474 } |
| 2475 | 2475 |
| 2476 static bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineIn
fo) | 2476 static bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineIn
fo) |
| 2477 { | 2477 { |
| 2478 RenderObject* parent = flow->parent(); | 2478 RenderObject* parent = flow->parent(); |
| 2479 if (flow->document()->inNoQuirksMode() | 2479 if (flow->document().inNoQuirksMode() |
| 2480 && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(l
ineInfo.isFirstLine())->lineHeight() | 2480 && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(l
ineInfo.isFirstLine())->lineHeight() |
| 2481 || flow->style()->verticalAlign() != parent->style()->verticalAlign() | 2481 || flow->style()->verticalAlign() != parent->style()->verticalAlign() |
| 2482 || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLi
neGap(flow->style()->font().fontMetrics()))) | 2482 || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLi
neGap(flow->style()->font().fontMetrics()))) |
| 2483 return true; | 2483 return true; |
| 2484 return false; | 2484 return false; |
| 2485 } | 2485 } |
| 2486 | 2486 |
| 2487 static bool alwaysRequiresLineBox(RenderObject* flow) | 2487 static bool alwaysRequiresLineBox(RenderObject* flow) |
| 2488 { | 2488 { |
| 2489 // FIXME: Right now, we only allow line boxes for inlines that are truly emp
ty. | 2489 // FIXME: Right now, we only allow line boxes for inlines that are truly emp
ty. |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 bool startingNewParagraph = lineInfo.previousLineBrokeCleanly(); | 2792 bool startingNewParagraph = lineInfo.previousLineBrokeCleanly(); |
| 2793 lineInfo.setPreviousLineBrokeCleanly(false); | 2793 lineInfo.setPreviousLineBrokeCleanly(false); |
| 2794 | 2794 |
| 2795 bool autoWrapWasEverTrueOnLine = false; | 2795 bool autoWrapWasEverTrueOnLine = false; |
| 2796 bool floatsFitOnLine = true; | 2796 bool floatsFitOnLine = true; |
| 2797 | 2797 |
| 2798 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under | 2798 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under |
| 2799 // very specific circumstances (in order to match common WinIE renderings). | 2799 // very specific circumstances (in order to match common WinIE renderings). |
| 2800 // Not supporting the quirk has caused us to mis-render some real sites. (Se
e Bugzilla 10517.) | 2800 // Not supporting the quirk has caused us to mis-render some real sites. (Se
e Bugzilla 10517.) |
| 2801 RenderStyle* blockStyle = m_block->style(); | 2801 RenderStyle* blockStyle = m_block->style(); |
| 2802 bool allowImagesToBreak = !m_block->document()->inQuirksMode() || !m_block->
isTableCell() || !blockStyle->logicalWidth().isIntrinsicOrAuto(); | 2802 bool allowImagesToBreak = !m_block->document().inQuirksMode() || !m_block->i
sTableCell() || !blockStyle->logicalWidth().isIntrinsicOrAuto(); |
| 2803 | 2803 |
| 2804 EWhiteSpace currWS = blockStyle->whiteSpace(); | 2804 EWhiteSpace currWS = blockStyle->whiteSpace(); |
| 2805 EWhiteSpace lastWS = currWS; | 2805 EWhiteSpace lastWS = currWS; |
| 2806 while (current.m_obj) { | 2806 while (current.m_obj) { |
| 2807 RenderStyle* currentStyle = current.m_obj->style(); | 2807 RenderStyle* currentStyle = current.m_obj->style(); |
| 2808 RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj
); | 2808 RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj
); |
| 2809 if (next && next->parent() && !next->parent()->isDescendantOf(current.m_
obj->parent())) | 2809 if (next && next->parent() && !next->parent()->isDescendantOf(current.m_
obj->parent())) |
| 2810 includeEndWidth = true; | 2810 includeEndWidth = true; |
| 2811 | 2811 |
| 2812 currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()-
>whiteSpace() : currentStyle->whiteSpace(); | 2812 currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()-
>whiteSpace() : currentStyle->whiteSpace(); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3525 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
| 3526 | 3526 |
| 3527 setLineGridBox(lineGridBox); | 3527 setLineGridBox(lineGridBox); |
| 3528 | 3528 |
| 3529 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3529 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
| 3530 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3530 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
| 3531 // to this grid. | 3531 // to this grid. |
| 3532 } | 3532 } |
| 3533 | 3533 |
| 3534 } | 3534 } |
| OLD | NEW |