Changeset 107263 in webkit
- Timestamp:
- Feb 9, 2012 11:11:57 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107261 r107263 1 2012-02-09 David Barton <dbarton@mathscribe.com> 2 3 MathML internals for bug 52444 fix - type checking, PassRefPtr 4 https://bugs.webkit.org/show_bug.cgi?id=78180 5 6 Reviewed by Eric Seidel. 7 8 static_cast<Element*>(node()) is done in methods in RenderMathMLFenced.cpp and a few 9 other files. It is more type-safe if the RenderMathMLFenced() or other constructor only 10 accepts an Element*, not a Node*. Also a couple functions were changed to return a 11 PassRefPtr instead of a RefPtr. 12 13 No new tests. 14 15 * rendering/mathml/RenderMathMLFenced.cpp: 16 (WebCore::RenderMathMLFenced::RenderMathMLFenced): 17 (WebCore::RenderMathMLFenced::updateFromElement): 18 (WebCore::RenderMathMLFenced::makeOperatorStyle): 19 (WebCore::RenderMathMLFenced::makeFences): 20 (WebCore::RenderMathMLFenced::addChild): 21 * rendering/mathml/RenderMathMLFenced.h: 22 (RenderMathMLFenced): 23 * rendering/mathml/RenderMathMLFraction.cpp: 24 (WebCore::RenderMathMLFraction::RenderMathMLFraction): 25 * rendering/mathml/RenderMathMLFraction.h: 26 (RenderMathMLFraction): 27 * rendering/mathml/RenderMathMLMath.cpp: 28 (WebCore::RenderMathMLMath::RenderMathMLMath): 29 * rendering/mathml/RenderMathMLMath.h: 30 (RenderMathMLMath): 31 * rendering/mathml/RenderMathMLOperator.cpp: 32 (WebCore::RenderMathMLOperator::RenderMathMLOperator): 33 (WebCore::RenderMathMLOperator::updateFromElement): 34 (WebCore::RenderMathMLOperator::createStackableStyle): 35 (WebCore::RenderMathMLOperator::createGlyph): 36 * rendering/mathml/RenderMathMLOperator.h: 37 (RenderMathMLOperator): 38 * rendering/mathml/RenderMathMLRoot.cpp: 39 (WebCore::RenderMathMLRoot::RenderMathMLRoot): 40 (WebCore::RenderMathMLRoot::layout): 41 * rendering/mathml/RenderMathMLRoot.h: 42 (RenderMathMLRoot): 43 * rendering/mathml/RenderMathMLRow.cpp: 44 (WebCore::RenderMathMLRow::RenderMathMLRow): 45 * rendering/mathml/RenderMathMLRow.h: 46 (RenderMathMLRow): 47 * rendering/mathml/RenderMathMLSquareRoot.cpp: 48 (WebCore::RenderMathMLSquareRoot::RenderMathMLSquareRoot): 49 * rendering/mathml/RenderMathMLSquareRoot.h: 50 (RenderMathMLSquareRoot): 51 * rendering/mathml/RenderMathMLSubSup.cpp: 52 (WebCore::RenderMathMLSubSup::addChild): 53 * rendering/mathml/RenderMathMLSubSup.h: 54 (RenderMathMLSubSup): 55 * rendering/mathml/RenderMathMLUnderOver.cpp: 56 (WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver): 57 * rendering/mathml/RenderMathMLUnderOver.h: 58 (RenderMathMLUnderOver): 59 1 60 2012-02-09 Andreas Kling <awesomekling@apple.com> 2 61 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
r103824 r107263 45 45 static const float gOperatorPadding = 0.1f; 46 46 47 RenderMathMLFenced::RenderMathMLFenced( Node* fenced)48 : RenderMathMLRow( fenced)47 RenderMathMLFenced::RenderMathMLFenced(Element* element) 48 : RenderMathMLRow(element) 49 49 , m_open(OpeningBraceChar) 50 50 , m_close(ClosingBraceChar) … … 64 64 m_close = closeValue[0]; 65 65 66 AtomicString separators = static_cast<Element*>(fenced)->getAttribute(MathMLNames::separatorsAttr);66 AtomicString separators = fenced->getAttribute(MathMLNames::separatorsAttr); 67 67 if (!separators.isNull()) { 68 68 StringBuilder characters; … … 81 81 } 82 82 83 RefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle() 83 PassRefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle() 84 84 { 85 85 RefPtr<RenderStyle> newStyle = RenderStyle::create(); … … 87 87 newStyle->setDisplay(INLINE_BLOCK); 88 88 newStyle->setPaddingRight(Length(static_cast<int>(gOperatorPadding * style()->fontSize()), Fixed)); 89 return newStyle ;89 return newStyle.release(); 90 90 } 91 91 … … 93 93 { 94 94 RenderObject* openFence = new (renderArena()) RenderMathMLOperator(node(), m_open); 95 openFence->setStyle(makeOperatorStyle() .release());95 openFence->setStyle(makeOperatorStyle()); 96 96 RenderBlock::addChild(openFence, firstChild()); 97 97 RenderObject* closeFence = new (renderArena()) RenderMathMLOperator(node(), m_close); 98 closeFence->setStyle(makeOperatorStyle() .release());98 closeFence->setStyle(makeOperatorStyle()); 99 99 RenderBlock::addChild(closeFence); 100 100 } … … 123 123 124 124 RenderObject* separatorObj = new (renderArena()) RenderMathMLOperator(node(), separator); 125 separatorObj->setStyle(makeOperatorStyle() .release());125 separatorObj->setStyle(makeOperatorStyle()); 126 126 RenderBlock::addChild(separatorObj, lastChild()); 127 127 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h
r95901 r107263 35 35 class RenderMathMLFenced : public RenderMathMLRow { 36 36 public: 37 RenderMathMLFenced( Node *fraction);37 RenderMathMLFenced(Element*); 38 38 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); 39 39 virtual void updateFromElement(); … … 42 42 virtual const char* renderName() const { return "RenderMathMLFenced"; } 43 43 44 PassRefPtr<RenderStyle> makeOperatorStyle(); 44 45 void makeFences(); 45 RefPtr<RenderStyle> makeOperatorStyle();46 46 47 UChar m_open; 47 48 UChar m_close; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
r107019 r107263 47 47 static const float gDenominatorPad = 0.1f; 48 48 49 RenderMathMLFraction::RenderMathMLFraction(Element* fraction)50 : RenderMathMLBlock( fraction)49 RenderMathMLFraction::RenderMathMLFraction(Element* element) 50 : RenderMathMLBlock(element) 51 51 , m_lineThickness(gLineMedium) 52 52 { -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h
r106900 r107263 36 36 class RenderMathMLFraction : public RenderMathMLBlock { 37 37 public: 38 RenderMathMLFraction(Element* fraction);38 RenderMathMLFraction(Element*); 39 39 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); 40 40 virtual void updateFromElement(); … … 45 45 private: 46 46 virtual const char* renderName() const { return "RenderMathMLFraction"; } 47 47 48 float m_lineThickness; 48 49 }; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp
r107019 r107263 36 36 using namespace MathMLNames; 37 37 38 RenderMathMLMath::RenderMathMLMath( Node* math)39 : RenderMathMLRow( math)38 RenderMathMLMath::RenderMathMLMath(Element* element) 39 : RenderMathMLRow(element) 40 40 { 41 41 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h
r107019 r107263 35 35 class RenderMathMLMath : public RenderMathMLRow { 36 36 public: 37 RenderMathMLMath( Node* container);37 RenderMathMLMath(Element*); 38 38 virtual bool isRenderMathMLMath() const { return true; } 39 39 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r106900 r107263 39 39 using namespace MathMLNames; 40 40 41 RenderMathMLOperator::RenderMathMLOperator( Node* container)42 : RenderMathMLBlock( container)41 RenderMathMLOperator::RenderMathMLOperator(Element* element) 42 : RenderMathMLBlock(element) 43 43 , m_stretchHeight(0) 44 44 , m_operator(0) … … 46 46 } 47 47 48 RenderMathMLOperator::RenderMathMLOperator(Node* container, UChar operatorChar)49 : RenderMathMLBlock( container)48 RenderMathMLOperator::RenderMathMLOperator(Node* node, UChar operatorChar) 49 : RenderMathMLBlock(node) 50 50 , m_stretchHeight(0) 51 51 , m_operator(convertHyphenMinusToMinusSign(operatorChar)) … … 140 140 bool stretchDisabled = false; 141 141 142 // We ma deneed the element later if we can't stretch.142 // We may need the element later if we can't stretch. 143 143 if (node()->nodeType() == Node::ELEMENT_NODE) { 144 144 if (Element* mo = static_cast<Element*>(node())) { … … 283 283 } 284 284 285 RefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int size, int topRelative)285 PassRefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int size, int topRelative) 286 286 { 287 287 RefPtr<RenderStyle> newStyle = RenderStyle::create(); … … 308 308 } 309 309 310 return newStyle ;310 return newStyle.release(); 311 311 } 312 312 … … 314 314 { 315 315 RenderBlock* container = new (renderArena()) RenderMathMLBlock(node()); 316 container->setStyle(createStackableStyle(size, topRelative) .release());316 container->setStyle(createStackableStyle(size, topRelative)); 317 317 addChild(container); 318 318 RenderBlock* parent = container; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r107019 r107263 36 36 class RenderMathMLOperator : public RenderMathMLBlock { 37 37 public: 38 RenderMathMLOperator( Node* container);39 RenderMathMLOperator(Node* container, UChar operatorChar);38 RenderMathMLOperator(Element*); 39 RenderMathMLOperator(Node*, UChar operatorChar); 40 40 virtual bool isRenderMathMLOperator() const { return true; } 41 41 virtual void stretchToHeight(int pixelHeight); … … 46 46 protected: 47 47 virtual void layout(); 48 virtual RefPtr<RenderStyle> createStackableStyle(int size, int topRelative);48 virtual PassRefPtr<RenderStyle> createStackableStyle(int size, int topRelative); 49 49 virtual RenderBlock* createGlyph(UChar glyph, int size = 0, int charRelative = 0, int topRelative = 0); 50 50 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
r107019 r107263 65 65 const float gRadicalThickLineThickness = 0.1f; 66 66 67 RenderMathMLRoot::RenderMathMLRoot( Node *expression)68 : RenderMathMLBlock(expression) 67 RenderMathMLRoot::RenderMathMLRoot(Element* element) 68 : RenderMathMLBlock(element) 69 69 { 70 70 } … … 233 233 LayoutUnit indexShift = indexBox->offsetWidth() + topStartShift; 234 234 LayoutUnit radicalHeight = static_cast<LayoutUnit>((1 - gRadicalTopLeftPointYPos) * maxHeight); 235 LayoutUnit rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight() - (maxHeight + static_cast<LayoutUnit>(gRootPadding * style()->fontSize())); 235 LayoutUnit rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight() 236 - (maxHeight + static_cast<LayoutUnit>(gRootPadding * style()->fontSize())); 236 237 237 238 style()->setPaddingLeft(Length(indexShift, Fixed)); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
r95901 r107263 35 35 class RenderMathMLRoot : public RenderMathMLBlock { 36 36 public: 37 RenderMathMLRoot( Node* fraction);37 RenderMathMLRoot(Element*); 38 38 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); 39 39 virtual void paint(PaintInfo&, const LayoutPoint&); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
r107019 r107263 37 37 using namespace MathMLNames; 38 38 39 RenderMathMLRow::RenderMathMLRow( Node* row)40 : RenderMathMLBlock( row)39 RenderMathMLRow::RenderMathMLRow(Element* element) 40 : RenderMathMLBlock(element) 41 41 { 42 42 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h
r107019 r107263 35 35 class RenderMathMLRow : public RenderMathMLBlock { 36 36 public: 37 RenderMathMLRow( Node* container);37 RenderMathMLRow(Element*); 38 38 virtual bool isRenderMathMLRow() const { return true; } 39 39 virtual int nonOperatorHeight() const; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp
r107019 r107263 62 62 const float gRadicalThickLineThickness = 0.1f; 63 63 64 RenderMathMLSquareRoot::RenderMathMLSquareRoot( Node *expression)65 : RenderMathMLBlock(e xpression)64 RenderMathMLSquareRoot::RenderMathMLSquareRoot(Element* element) 65 : RenderMathMLBlock(element) 66 66 { 67 67 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h
r107019 r107263 35 35 class RenderMathMLSquareRoot : public RenderMathMLBlock { 36 36 public: 37 RenderMathMLSquareRoot( Node* fraction);37 RenderMathMLSquareRoot(Element*); 38 38 virtual void paint(PaintInfo&, const LayoutPoint&); 39 39 protected: -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp
r107019 r107263 57 57 void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild) 58 58 { 59 60 59 // Note: The RenderMathMLBlock only allows element children to be added. 61 60 Element* childElement = toElement(child->node()); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h
r107019 r107263 35 35 class RenderMathMLSubSup : public RenderMathMLBlock { 36 36 public: 37 RenderMathMLSubSup(Element* fraction);37 RenderMathMLSubSup(Element*); 38 38 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); 39 39 virtual bool hasBase() const { return true; } … … 58 58 59 59 #endif // RenderMathMLSubSup_h 60 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
r107019 r107263 39 39 static const double gOverSpacingAdjustment = 0.5; 40 40 41 RenderMathMLUnderOver::RenderMathMLUnderOver(Node* expression) 42 : RenderMathMLBlock(expression) 43 { 44 Element* element = static_cast<Element*>(expression); 41 RenderMathMLUnderOver::RenderMathMLUnderOver(Element* element) 42 : RenderMathMLBlock(element) 43 { 45 44 // Determine what kind of under/over expression we have by element name 46 45 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
r107019 r107263 35 35 class RenderMathMLUnderOver : public RenderMathMLBlock { 36 36 public: 37 RenderMathMLUnderOver( Node* expression);37 RenderMathMLUnderOver(Element*); 38 38 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); 39 39 virtual void layout();
Note: See TracChangeset
for help on using the changeset viewer.