Changeset 89273 in webkit
- Timestamp:
- Jun 20, 2011 12:35:50 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 21 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89270 r89273 1 2011-06-20 Alex Milowski <alex@milowski.com> 2 3 Reviewed by Darin Adler. 4 5 New tests for scripting changes to DOM for msub, msup, msubsup. 6 https://bugs.webkit.org/show_bug.cgi?id=62098 7 8 * mathml/presentation/msub-base-changed.xhtml: Added. 9 * mathml/presentation/msub-sub-changed.xhtml: Added. 10 * mathml/presentation/msubsup-base-changed.xhtml: Added. 11 * mathml/presentation/msubsup-sub-changed.xhtml: Added. 12 * mathml/presentation/msubsup-sup-changed.xhtml: Added. 13 * mathml/presentation/msup-base-changed.xhtml: Added. 14 * mathml/presentation/msup-sup-changed.xhtml: Added. 15 * platform/mac/mathml/presentation/msub-base-changed-expected.png: Added. 16 * platform/mac/mathml/presentation/msub-base-changed-expected.txt: Added. 17 * platform/mac/mathml/presentation/msub-sub-changed-expected.png: Added. 18 * platform/mac/mathml/presentation/msub-sub-changed-expected.txt: Added. 19 * platform/mac/mathml/presentation/msubsup-base-changed-expected.png: Added. 20 * platform/mac/mathml/presentation/msubsup-base-changed-expected.txt: Added. 21 * platform/mac/mathml/presentation/msubsup-sub-changed-expected.png: Added. 22 * platform/mac/mathml/presentation/msubsup-sub-changed-expected.txt: Added. 23 * platform/mac/mathml/presentation/msubsup-sup-changed-expected.png: Added. 24 * platform/mac/mathml/presentation/msubsup-sup-changed-expected.txt: Added. 25 * platform/mac/mathml/presentation/msup-base-changed-expected.png: Added. 26 * platform/mac/mathml/presentation/msup-base-changed-expected.txt: Added. 27 * platform/mac/mathml/presentation/msup-sup-changed-expected.png: Added. 28 * platform/mac/mathml/presentation/msup-sup-changed-expected.txt: Added. 29 1 30 2011-06-20 Chang Shu <cshu@webkit.org> 2 31 -
trunk/Source/WebCore/ChangeLog
r89271 r89273 1 2011-06-20 Alex Milowski <alex@milowski.com> 2 3 Reviewed by Darin Adler. 4 5 This patch addresses handling wrapping of child properly to maintain the layout regardless of whether 6 this is the initial build of the render tree or the result of DOM manipulation. 7 https://bugs.webkit.org/show_bug.cgi?id=62098 8 9 Tests: mathml/presentation/msub-base-changed.xhtml 10 mathml/presentation/msub-sub-changed.xhtml 11 mathml/presentation/msubsup-base-changed.xhtml 12 mathml/presentation/msubsup-sub-changed.xhtml 13 mathml/presentation/msubsup-sup-changed.xhtml 14 mathml/presentation/msup-base-changed.xhtml 15 mathml/presentation/msup-sup-changed.xhtml 16 17 * rendering/mathml/RenderMathMLSubSup.cpp: 18 (WebCore::RenderMathMLSubSup::addChild): 19 (WebCore::RenderMathMLSubSup::stretchToHeight): 20 (WebCore::RenderMathMLSubSup::baselinePosition): 21 1 22 2011-06-01 Jer Noble <jer.noble@apple.com> 2 23 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp
r88730 r89273 64 64 void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild) 65 65 { 66 if (firstChild()) { 67 // We already have a base, so this is the super/subscripts being added. 68 69 if (m_kind == SubSup) { 70 if (!m_scripts) { 71 m_scripts = new (renderArena()) RenderMathMLBlock(node()); 72 RefPtr<RenderStyle> scriptsStyle = RenderStyle::create(); 73 scriptsStyle->inheritFrom(style()); 74 scriptsStyle->setDisplay(INLINE_BLOCK); 75 scriptsStyle->setVerticalAlign(TOP); 76 scriptsStyle->setMarginLeft(Length(gSubsupScriptMargin, Fixed)); 77 scriptsStyle->setTextAlign(LEFT); 78 m_scripts->setStyle(scriptsStyle.release()); 79 RenderMathMLBlock::addChild(m_scripts, beforeChild); 80 } 81 82 RenderBlock* script = new (renderArena()) RenderMathMLBlock(node()); 83 RefPtr<RenderStyle> scriptStyle = RenderStyle::create(); 84 scriptStyle->inheritFrom(m_scripts->style()); 85 scriptStyle->setDisplay(BLOCK); 86 script->setStyle(scriptStyle.release()); 87 88 m_scripts->addChild(script, m_scripts->firstChild()); 89 script->addChild(child); 90 } else 91 RenderMathMLBlock::addChild(child, beforeChild); 92 93 } else { 66 67 // Note: The RenderMathMLBlock only allows element children to be added. 68 Element* childElement = toElement(child->node()); 69 70 if (!childElement->previousElementSibling()) { 71 // Position 1 is always the base of the msub/msup/msubsup. 94 72 RenderMathMLBlock* wrapper = new (renderArena()) RenderMathMLBlock(node()); 95 73 RefPtr<RenderStyle> wrapperStyle = RenderStyle::create(); … … 98 76 wrapperStyle->setVerticalAlign(BASELINE); 99 77 wrapper->setStyle(wrapperStyle.release()); 100 RenderMathMLBlock::addChild(wrapper, beforeChild);78 RenderMathMLBlock::addChild(wrapper, firstChild()); 101 79 wrapper->addChild(child); 102 80 81 // Make sure we have a script block for rendering. 82 if (m_kind == SubSup && !m_scripts) { 83 m_scripts = new (renderArena()) RenderMathMLBlock(node()); 84 RefPtr<RenderStyle> scriptsStyle = RenderStyle::create(); 85 scriptsStyle->inheritFrom(style()); 86 scriptsStyle->setDisplay(INLINE_BLOCK); 87 scriptsStyle->setVerticalAlign(TOP); 88 scriptsStyle->setMarginLeft(Length(gSubsupScriptMargin, Fixed)); 89 scriptsStyle->setTextAlign(LEFT); 90 m_scripts->setStyle(scriptsStyle.release()); 91 RenderMathMLBlock::addChild(m_scripts, beforeChild); 92 } 93 } else { 94 if (m_kind == SubSup) { 95 RenderBlock* script = new (renderArena()) RenderMathMLBlock(node()); 96 RefPtr<RenderStyle> scriptStyle = RenderStyle::create(); 97 scriptStyle->inheritFrom(m_scripts->style()); 98 scriptStyle->setDisplay(BLOCK); 99 script->setStyle(scriptStyle.release()); 100 101 // The order is always backwards so the first script is the subscript and the superscript 102 // is last. That means the superscript is the first to render vertically. 103 Element* previousSibling = childElement->previousElementSibling(); 104 if (previousSibling && !previousSibling->previousElementSibling()) 105 m_scripts->addChild(script); 106 else 107 m_scripts->addChild(script, m_scripts->firstChild()); 108 109 script->addChild(child); 110 } else 111 RenderMathMLBlock::addChild(child, beforeChild); 103 112 } 104 113 } … … 186 195 case SubSup: 187 196 base = base->firstChild(); 188 if (!base) 189 break; 190 191 if (m_scripts && base->isBoxModelObject()) { 197 if (m_scripts && base && base->isBoxModelObject()) { 192 198 RenderBoxModelObject* box = toRenderBoxModelObject(base); 193 199 194 200 int topAdjust = (m_scripts->offsetHeight() - box->offsetHeight()) / 2; 195 201 196 // FIXME: The last bit of this calculation should be more exact. 202 // FIXME: The last bit of this calculation should be more exact. Why is the 2-3px scaled for zoom necessary? 197 203 // The baseline is top spacing of the base + the baseline of the base + adjusted space for zoom 198 204 float zoomFactor = style()->effectiveZoom();
Note: See TracChangeset
for help on using the changeset viewer.