nsMathMLmrowFrame.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsMathMLmrowFrame.h"
  6. #include "mozilla/gfx/2D.h"
  7. //
  8. // <mrow> -- horizontally group any number of subexpressions - implementation
  9. //
  10. nsIFrame*
  11. NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
  12. {
  13. return new (aPresShell) nsMathMLmrowFrame(aContext);
  14. }
  15. NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame)
  16. nsMathMLmrowFrame::~nsMathMLmrowFrame()
  17. {
  18. }
  19. NS_IMETHODIMP
  20. nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
  21. {
  22. // let the base class get the default from our parent
  23. nsMathMLContainerFrame::InheritAutomaticData(aParent);
  24. mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
  25. return NS_OK;
  26. }
  27. nsresult
  28. nsMathMLmrowFrame::AttributeChanged(int32_t aNameSpaceID,
  29. nsIAtom* aAttribute,
  30. int32_t aModType)
  31. {
  32. // Special for <mtable>: In the frame construction code, we also use
  33. // this frame class as a wrapper for mtable. Hence, we should pass the
  34. // notification to the real mtable
  35. if (mContent->IsMathMLElement(nsGkAtoms::mtable_)) {
  36. nsIFrame* frame = mFrames.FirstChild();
  37. for ( ; frame; frame = frame->PrincipalChildList().FirstChild()) {
  38. // drill down to the real mtable
  39. if (frame->GetType() == nsGkAtoms::tableWrapperFrame)
  40. return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType);
  41. }
  42. NS_NOTREACHED("mtable wrapper without the real table frame");
  43. }
  44. return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
  45. }
  46. /* virtual */ eMathMLFrameType
  47. nsMathMLmrowFrame::GetMathMLFrameType()
  48. {
  49. if (!IsMrowLike()) {
  50. nsIMathMLFrame* child = do_QueryFrame(mFrames.FirstChild());
  51. if (child) {
  52. // We only have one child, so we return the frame type of that child as if
  53. // we didn't exist.
  54. return child->GetMathMLFrameType();
  55. }
  56. }
  57. return nsMathMLFrame::GetMathMLFrameType();
  58. }