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 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 handled = true; | 998 handled = true; |
999 | 999 |
1000 // Remove the old child. | 1000 // Remove the old child. |
1001 RenderBox* next = blockRunIn->nextSiblingBox(); | 1001 RenderBox* next = blockRunIn->nextSiblingBox(); |
1002 children()->removeChildNode(this, blockRunIn); | 1002 children()->removeChildNode(this, blockRunIn); |
1003 | 1003 |
1004 // Create an inline. | 1004 // Create an inline. |
1005 RenderInline* inlineRunIn = new (renderArena()) RenderInline(blockRu
nIn->node()); | 1005 RenderInline* inlineRunIn = new (renderArena()) RenderInline(blockRu
nIn->node()); |
1006 inlineRunIn->setStyle(blockRunIn->style()); | 1006 inlineRunIn->setStyle(blockRunIn->style()); |
1007 | 1007 |
1008 // Move the nodes from the old child to the new child. | 1008 // Move the nodes from the old child to the new child, but skip any
:before/:after content. It has already |
1009 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild
; runInChild = runInChild->nextSibling()) | 1009 // been regenerated by the new inline. |
1010 moveChild(inlineRunIn, inlineRunIn->children(), blockRunIn, bloc
kRunIn->children(), runInChild); | 1010 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild
; runInChild = runInChild->nextSibling()) { |
| 1011 if (runInChild->style()->styleType() != BEFORE && runInChild->st
yle()->styleType() != AFTER) { |
| 1012 blockRunIn->children()->removeChildNode(blockRunIn, runInChi
ld, false); |
| 1013 inlineRunIn->addChild(runInChild); // Use addChild instead o
f appendChildNode since it handles correct placement of the children relative to
:after-generated content. |
| 1014 } |
| 1015 } |
1011 | 1016 |
1012 // Now insert the new child under |currBlock|. | 1017 // Now insert the new child under |currBlock|. |
1013 currBlock->children()->insertChildNode(currBlock, inlineRunIn, currB
lock->firstChild()); | 1018 currBlock->children()->insertChildNode(currBlock, inlineRunIn, currB
lock->firstChild()); |
1014 | 1019 |
1015 // If the run-in had an element, we need to set the new renderer. | 1020 // If the run-in had an element, we need to set the new renderer. |
1016 if (blockRunIn->element()) | 1021 if (blockRunIn->element()) |
1017 blockRunIn->element()->setRenderer(inlineRunIn); | 1022 blockRunIn->element()->setRenderer(inlineRunIn); |
1018 | 1023 |
1019 // Destroy the block run-in. | 1024 // Destroy the block run-in. |
1020 blockRunIn->destroy(); | 1025 blockRunIn->destroy(); |
(...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3911 return current; | 3916 return current; |
3912 } | 3917 } |
3913 | 3918 |
3914 static int getBPMWidth(int childValue, Length cssUnit) | 3919 static int getBPMWidth(int childValue, Length cssUnit) |
3915 { | 3920 { |
3916 if (cssUnit.type() != Auto) | 3921 if (cssUnit.type() != Auto) |
3917 return (cssUnit.isFixed() ? cssUnit.value() : childValue); | 3922 return (cssUnit.isFixed() ? cssUnit.value() : childValue); |
3918 return 0; | 3923 return 0; |
3919 } | 3924 } |
3920 | 3925 |
3921 static int getBorderPaddingMargin(const RenderBox* child, bool endOfInline) | 3926 static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfI
nline) |
3922 { | 3927 { |
3923 RenderStyle* cstyle = child->style(); | 3928 RenderStyle* cstyle = child->style(); |
3924 int result = 0; | 3929 int result = 0; |
3925 bool leftSide = (cstyle->direction() == LTR) ? !endOfInline : endOfInline; | 3930 bool leftSide = (cstyle->direction() == LTR) ? !endOfInline : endOfInline; |
3926 result += getBPMWidth((leftSide ? child->marginLeft() : child->marginRight()
), | 3931 result += getBPMWidth((leftSide ? child->marginLeft() : child->marginRight()
), |
3927 (leftSide ? cstyle->marginLeft() : | 3932 (leftSide ? cstyle->marginLeft() : |
3928 cstyle->marginRight())); | 3933 cstyle->marginRight())); |
3929 result += getBPMWidth((leftSide ? child->paddingLeft() : child->paddingRight
()), | 3934 result += getBPMWidth((leftSide ? child->paddingLeft() : child->paddingRight
()), |
3930 (leftSide ? cstyle->paddingLeft() : | 3935 (leftSide ? cstyle->paddingLeft() : |
3931 cstyle->paddingRight())); | 3936 cstyle->paddingRight())); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4014 // (unless we end in whitespace). | 4019 // (unless we end in whitespace). |
4015 RenderStyle* cstyle = child->style(); | 4020 RenderStyle* cstyle = child->style(); |
4016 int childMin = 0; | 4021 int childMin = 0; |
4017 int childMax = 0; | 4022 int childMax = 0; |
4018 | 4023 |
4019 if (!child->isText()) { | 4024 if (!child->isText()) { |
4020 // Case (1) and (2). Inline replaced and inline flow elements. | 4025 // Case (1) and (2). Inline replaced and inline flow elements. |
4021 if (child->isRenderInline()) { | 4026 if (child->isRenderInline()) { |
4022 // Add in padding/border/margin from the appropriate side of | 4027 // Add in padding/border/margin from the appropriate side of |
4023 // the element. | 4028 // the element. |
4024 int bpm = getBorderPaddingMargin(static_cast<RenderBox*>(chi
ld), childIterator.endOfInline); | 4029 int bpm = getBorderPaddingMargin(toRenderInline(child), chil
dIterator.endOfInline); |
4025 childMin += bpm; | 4030 childMin += bpm; |
4026 childMax += bpm; | 4031 childMax += bpm; |
4027 | 4032 |
4028 inlineMin += childMin; | 4033 inlineMin += childMin; |
4029 inlineMax += childMax; | 4034 inlineMax += childMax; |
4030 | 4035 |
4031 child->setPrefWidthsDirty(false); | 4036 child->setPrefWidthsDirty(false); |
4032 } else { | 4037 } else { |
4033 // Inline replaced elts add in their margins to their min/ma
x values. | 4038 // Inline replaced elts add in their margins to their min/ma
x values. |
4034 int margins = 0; | 4039 int margins = 0; |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5009 return "RenderBlock (generated)"; | 5014 return "RenderBlock (generated)"; |
5010 if (isRelPositioned()) | 5015 if (isRelPositioned()) |
5011 return "RenderBlock (relative positioned)"; | 5016 return "RenderBlock (relative positioned)"; |
5012 if (isRunIn()) | 5017 if (isRunIn()) |
5013 return "RenderBlock (run-in)"; | 5018 return "RenderBlock (run-in)"; |
5014 return "RenderBlock"; | 5019 return "RenderBlock"; |
5015 } | 5020 } |
5016 | 5021 |
5017 } // namespace WebCore | 5022 } // namespace WebCore |
5018 | 5023 |
OLD | NEW |