From 96b895330a08578dac2b0c26a51535c40e862e90 Mon Sep 17 00:00:00 2001 From: "jwatt%jwatt.org" Date: Sun, 18 Nov 2007 12:09:09 +0000 Subject: [PATCH] Fixing bug 294086. should be a replaced element. r+sr=dbaron@mozilla.com blocking1.9=tor@acm.org git-svn-id: svn://10.0.0.236/trunk@239599 18797224-902f-48f8-a5cc-f745e15eee43 --- .../svg/content/src/nsSVGSVGElement.cpp | 22 -- .../content/svg/content/src/nsSVGSVGElement.h | 36 +- mozilla/layout/base/nsLayoutUtils.cpp | 148 ++++++-- mozilla/layout/base/nsLayoutUtils.h | 10 +- mozilla/layout/generic/nsFrame.cpp | 6 + mozilla/layout/generic/nsFrame.h | 1 + mozilla/layout/generic/nsFrameFrame.cpp | 131 +++++++- mozilla/layout/generic/nsHTMLCanvasFrame.cpp | 13 +- mozilla/layout/generic/nsHTMLReflowState.cpp | 3 +- mozilla/layout/generic/nsIFrame.h | 23 ++ mozilla/layout/generic/nsImageFrame.cpp | 10 +- mozilla/layout/generic/nsLineLayout.cpp | 8 + .../sizing/dynamic--inline-css-height.xhtml | 57 ++++ .../sizing/dynamic--inline-css-width.xhtml | 57 ++++ .../dynamic--inline-resize-cb-height.xhtml | 60 ++++ .../dynamic--inline-resize-cb-width.xhtml | 60 ++++ ...dynamic--inline-resize-window-height.xhtml | 60 ++++ .../dynamic--inline-resize-window-width.xhtml | 60 ++++ .../dynamic--object--auto-auto--pct-px.html | 42 +++ .../sizing/dynamic--object-svg-unloaded-a.svg | 41 +++ .../dynamic--object-svg-unloaded-b.xhtml | 42 +++ .../sizing/dynamic--object-svg-unloaded.xhtml | 48 +++ .../inline--display-block--01-ref.xhtml | 39 +++ .../sizing/inline--display-block--01.xhtml | 46 +++ .../inline--display-inline--01-ref.xhtml | 39 +++ .../sizing/inline--display-inline--01.xhtml | 46 +++ ...inline--display-inline-block--01-ref.xhtml | 39 +++ .../inline--display-inline-block--01.xhtml | 46 +++ .../sizing/inline--float-left--01-ref.xhtml | 39 +++ .../svg/sizing/inline--float-left--01.xhtml | 46 +++ .../sizing/inline--float-right--01-ref.xhtml | 39 +++ .../svg/sizing/inline--float-right--01.xhtml | 46 +++ .../inline--position-absolute--01-ref.xhtml | 39 +++ .../inline--position-absolute--01.xhtml | 46 +++ .../inline--position-relative--01-ref.xhtml | 39 +++ .../inline--position-relative--01.xhtml | 46 +++ .../svg/sizing/object--auto-auto--0-0.html | 42 +++ .../svg/sizing/object--auto-auto--0-0.svg | 13 + .../sizing/object--auto-auto--0-pct--ref.html | 37 ++ .../svg/sizing/object--auto-auto--0-pct.html | 43 +++ .../svg/sizing/object--auto-auto--0-pct.svg | 13 + .../sizing/object--auto-auto--0-px--ref.html | 37 ++ .../svg/sizing/object--auto-auto--0-px.html | 44 +++ .../svg/sizing/object--auto-auto--0-px.svg | 13 + .../sizing/object--auto-auto--pct-0--ref.html | 37 ++ .../svg/sizing/object--auto-auto--pct-0.html | 44 +++ .../svg/sizing/object--auto-auto--pct-0.svg | 13 + .../object--auto-auto--pct-pct--ref.html | 38 +++ .../sizing/object--auto-auto--pct-pct.html | 42 +++ .../svg/sizing/object--auto-auto--pct-pct.svg | 13 + .../object--auto-auto--pct-px--ref.html | 38 +++ .../svg/sizing/object--auto-auto--pct-px.html | 42 +++ .../svg/sizing/object--auto-auto--pct-px.svg | 13 + .../sizing/object--auto-auto--px-0--ref.html | 37 ++ .../svg/sizing/object--auto-auto--px-0.html | 42 +++ .../svg/sizing/object--auto-auto--px-0.svg | 13 + .../object--auto-auto--px-pct--ref.html | 38 +++ .../svg/sizing/object--auto-auto--px-pct.html | 42 +++ .../svg/sizing/object--auto-auto--px-pct.svg | 13 + .../sizing/object--auto-auto--px-px--ref.html | 38 +++ .../svg/sizing/object--auto-auto--px-px.html | 42 +++ .../svg/sizing/object--auto-auto--px-px.svg | 13 + .../layout/reftests/svg/sizing/pass-empty.svg | 8 + .../svg/sizing/pass-pct-height-square.xhtml | 26 ++ .../reftests/svg/sizing/pass-pct-pct.xhtml | 30 ++ .../reftests/svg/sizing/pass-pct-px.xhtml | 30 ++ .../svg/sizing/pass-pct-width-square.xhtml | 22 ++ .../reftests/svg/sizing/pass-px-pct.xhtml | 30 ++ .../reftests/svg/sizing/pass-px-px.xhtml | 30 ++ mozilla/layout/reftests/svg/sizing/pass.svg | 8 + .../layout/reftests/svg/sizing/reftest.list | 309 +++++++++++++++++ .../svg/sizing/standalone--0-0--0-0.svg | 20 ++ .../svg/sizing/standalone--0-0--0-pct.svg | 20 ++ .../svg/sizing/standalone--0-0--0-px.svg | 20 ++ .../svg/sizing/standalone--0-0--pct-0.svg | 20 ++ .../svg/sizing/standalone--0-0--pct-pct.svg | 20 ++ .../svg/sizing/standalone--0-0--pct-px.svg | 20 ++ .../svg/sizing/standalone--0-0--px-0.svg | 20 ++ .../svg/sizing/standalone--0-0--px-pct.svg | 20 ++ .../svg/sizing/standalone--0-0--px-px.svg | 20 ++ .../svg/sizing/standalone--0-auto--0-0.svg | 20 ++ .../svg/sizing/standalone--0-auto--0-pct.svg | 20 ++ .../svg/sizing/standalone--0-auto--0-px.svg | 20 ++ .../svg/sizing/standalone--0-auto--pct-0.svg | 20 ++ .../sizing/standalone--0-auto--pct-pct.svg | 20 ++ .../svg/sizing/standalone--0-auto--pct-px.svg | 20 ++ .../svg/sizing/standalone--0-auto--px-0.svg | 20 ++ .../svg/sizing/standalone--0-auto--px-pct.svg | 20 ++ .../svg/sizing/standalone--0-auto--px-px.svg | 20 ++ .../svg/sizing/standalone--0-pct--0-0.svg | 20 ++ .../svg/sizing/standalone--0-pct--0-pct.svg | 20 ++ .../svg/sizing/standalone--0-pct--0-px.svg | 20 ++ .../svg/sizing/standalone--0-pct--pct-0.svg | 20 ++ .../svg/sizing/standalone--0-pct--pct-pct.svg | 20 ++ .../svg/sizing/standalone--0-pct--pct-px.svg | 20 ++ .../svg/sizing/standalone--0-pct--px-0.svg | 20 ++ .../svg/sizing/standalone--0-pct--px-pct.svg | 20 ++ .../svg/sizing/standalone--0-pct--px-px.svg | 20 ++ .../svg/sizing/standalone--0-px--0-0.svg | 20 ++ .../svg/sizing/standalone--0-px--0-pct.svg | 20 ++ .../svg/sizing/standalone--0-px--0-px.svg | 20 ++ .../svg/sizing/standalone--0-px--pct-0.svg | 20 ++ .../svg/sizing/standalone--0-px--pct-pct.svg | 20 ++ .../svg/sizing/standalone--0-px--pct-px.svg | 20 ++ .../svg/sizing/standalone--0-px--px-0.svg | 20 ++ .../svg/sizing/standalone--0-px--px-pct.svg | 20 ++ .../svg/sizing/standalone--0-px--px-px.svg | 20 ++ .../svg/sizing/standalone--auto-0--0-0.svg | 20 ++ .../svg/sizing/standalone--auto-0--0-pct.svg | 20 ++ .../svg/sizing/standalone--auto-0--0-px.svg | 20 ++ .../svg/sizing/standalone--auto-0--pct-0.svg | 20 ++ .../sizing/standalone--auto-0--pct-pct.svg | 20 ++ .../svg/sizing/standalone--auto-0--pct-px.svg | 20 ++ .../svg/sizing/standalone--auto-0--px-0.svg | 20 ++ .../svg/sizing/standalone--auto-0--px-pct.svg | 20 ++ .../svg/sizing/standalone--auto-0--px-px.svg | 20 ++ .../svg/sizing/standalone--auto-auto--0-0.svg | 21 ++ .../sizing/standalone--auto-auto--0-pct.svg | 21 ++ .../sizing/standalone--auto-auto--0-px.svg | 21 ++ .../sizing/standalone--auto-auto--pct-0.svg | 21 ++ .../sizing/standalone--auto-auto--pct-pct.svg | 20 ++ .../sizing/standalone--auto-auto--pct-px.svg | 20 ++ .../sizing/standalone--auto-auto--px-0.svg | 21 ++ .../sizing/standalone--auto-auto--px-pct.svg | 20 ++ .../sizing/standalone--auto-auto--px-px.svg | 20 ++ .../svg/sizing/standalone--auto-pct--0-0.svg | 22 ++ .../sizing/standalone--auto-pct--0-pct.svg | 22 ++ .../svg/sizing/standalone--auto-pct--0-px.svg | 22 ++ .../sizing/standalone--auto-pct--pct-0.svg | 21 ++ ...standalone--auto-pct--pct-pct--viewBox.svg | 23 ++ .../sizing/standalone--auto-pct--pct-pct.svg | 21 ++ .../standalone--auto-pct--pct-px--viewBox.svg | 23 ++ .../sizing/standalone--auto-pct--pct-px.svg | 21 ++ .../svg/sizing/standalone--auto-pct--px-0.svg | 21 ++ .../standalone--auto-pct--px-pct--viewBox.svg | 23 ++ .../sizing/standalone--auto-pct--px-pct.svg | 21 ++ .../sizing/standalone--auto-pct--px-px.svg | 20 ++ .../svg/sizing/standalone--auto-px--0-0.svg | 22 ++ .../svg/sizing/standalone--auto-px--0-pct.svg | 22 ++ .../svg/sizing/standalone--auto-px--0-px.svg | 22 ++ .../svg/sizing/standalone--auto-px--pct-0.svg | 21 ++ .../standalone--auto-px--pct-pct--viewBox.svg | 23 ++ .../sizing/standalone--auto-px--pct-pct.svg | 21 ++ .../standalone--auto-px--pct-px--viewBox.svg | 23 ++ .../sizing/standalone--auto-px--pct-px.svg | 21 ++ .../svg/sizing/standalone--auto-px--px-0.svg | 21 ++ .../standalone--auto-px--px-pct--viewBox.svg | 23 ++ .../sizing/standalone--auto-px--px-pct.svg | 21 ++ .../svg/sizing/standalone--auto-px--px-px.svg | 20 ++ .../svg/sizing/standalone--pct-0--0-0.svg | 20 ++ .../svg/sizing/standalone--pct-0--0-pct.svg | 20 ++ .../svg/sizing/standalone--pct-0--0-px.svg | 20 ++ .../svg/sizing/standalone--pct-0--pct-0.svg | 20 ++ .../svg/sizing/standalone--pct-0--pct-pct.svg | 20 ++ .../svg/sizing/standalone--pct-0--pct-px.svg | 20 ++ .../svg/sizing/standalone--pct-0--px-0.svg | 20 ++ .../svg/sizing/standalone--pct-0--px-pct.svg | 20 ++ .../svg/sizing/standalone--pct-0--px-px.svg | 20 ++ .../svg/sizing/standalone--pct-auto--0-0.svg | 22 ++ .../sizing/standalone--pct-auto--0-pct.svg | 21 ++ .../svg/sizing/standalone--pct-auto--0-px.svg | 21 ++ .../sizing/standalone--pct-auto--pct-0.svg | 22 ++ ...standalone--pct-auto--pct-pct--viewBox.svg | 23 ++ .../sizing/standalone--pct-auto--pct-pct.svg | 21 ++ .../standalone--pct-auto--pct-px--viewBox.svg | 23 ++ .../sizing/standalone--pct-auto--pct-px.svg | 21 ++ .../svg/sizing/standalone--pct-auto--px-0.svg | 22 ++ .../standalone--pct-auto--px-pct--viewBox.svg | 23 ++ .../sizing/standalone--pct-auto--px-pct.svg | 21 ++ .../sizing/standalone--pct-auto--px-px.svg | 20 ++ .../svg/sizing/standalone--pct-pct--0-0.svg | 20 ++ .../svg/sizing/standalone--pct-pct--0-pct.svg | 20 ++ .../svg/sizing/standalone--pct-pct--0-px.svg | 20 ++ .../svg/sizing/standalone--pct-pct--pct-0.svg | 20 ++ .../sizing/standalone--pct-pct--pct-pct.svg | 20 ++ .../sizing/standalone--pct-pct--pct-px.svg | 20 ++ .../svg/sizing/standalone--pct-pct--px-0.svg | 20 ++ .../sizing/standalone--pct-pct--px-pct.svg | 20 ++ .../svg/sizing/standalone--pct-pct--px-px.svg | 20 ++ .../svg/sizing/standalone--pct-px--0-0.svg | 20 ++ .../svg/sizing/standalone--pct-px--0-pct.svg | 20 ++ .../svg/sizing/standalone--pct-px--0-px.svg | 20 ++ .../svg/sizing/standalone--pct-px--pct-0.svg | 20 ++ .../sizing/standalone--pct-px--pct-pct.svg | 20 ++ .../svg/sizing/standalone--pct-px--pct-px.svg | 20 ++ .../svg/sizing/standalone--pct-px--px-0.svg | 20 ++ .../svg/sizing/standalone--pct-px--px-pct.svg | 20 ++ .../svg/sizing/standalone--pct-px--px-px.svg | 20 ++ .../svg/sizing/standalone--px-0--0-0.svg | 20 ++ .../svg/sizing/standalone--px-0--0-pct.svg | 20 ++ .../svg/sizing/standalone--px-0--0-px.svg | 20 ++ .../svg/sizing/standalone--px-0--pct-0.svg | 20 ++ .../svg/sizing/standalone--px-0--pct-pct.svg | 20 ++ .../svg/sizing/standalone--px-0--pct-px.svg | 20 ++ .../svg/sizing/standalone--px-0--px-0.svg | 20 ++ .../svg/sizing/standalone--px-0--px-pct.svg | 20 ++ .../svg/sizing/standalone--px-0--px-px.svg | 20 ++ .../svg/sizing/standalone--px-auto--0-0.svg | 22 ++ .../svg/sizing/standalone--px-auto--0-pct.svg | 21 ++ .../svg/sizing/standalone--px-auto--0-px.svg | 21 ++ .../svg/sizing/standalone--px-auto--pct-0.svg | 22 ++ .../standalone--px-auto--pct-pct--viewBox.svg | 23 ++ .../sizing/standalone--px-auto--pct-pct.svg | 21 ++ .../standalone--px-auto--pct-px--viewBox.svg | 23 ++ .../sizing/standalone--px-auto--pct-px.svg | 21 ++ .../svg/sizing/standalone--px-auto--px-0.svg | 22 ++ .../standalone--px-auto--px-pct--viewBox.svg | 23 ++ .../sizing/standalone--px-auto--px-pct.svg | 21 ++ .../svg/sizing/standalone--px-auto--px-px.svg | 20 ++ .../svg/sizing/standalone--px-pct--0-0.svg | 20 ++ .../svg/sizing/standalone--px-pct--0-pct.svg | 20 ++ .../svg/sizing/standalone--px-pct--0-px.svg | 20 ++ .../svg/sizing/standalone--px-pct--pct-0.svg | 20 ++ .../sizing/standalone--px-pct--pct-pct.svg | 20 ++ .../svg/sizing/standalone--px-pct--pct-px.svg | 20 ++ .../svg/sizing/standalone--px-pct--px-0.svg | 20 ++ .../svg/sizing/standalone--px-pct--px-pct.svg | 20 ++ .../svg/sizing/standalone--px-pct--px-px.svg | 20 ++ .../svg/sizing/standalone--px-px--0-0.svg | 20 ++ .../svg/sizing/standalone--px-px--0-pct.svg | 20 ++ .../svg/sizing/standalone--px-px--0-px.svg | 20 ++ .../svg/sizing/standalone--px-px--pct-0.svg | 20 ++ .../svg/sizing/standalone--px-px--pct-pct.svg | 20 ++ .../svg/sizing/standalone--px-px--pct-px.svg | 20 ++ .../svg/sizing/standalone--px-px--px-0.svg | 20 ++ .../svg/sizing/standalone--px-px--px-pct.svg | 20 ++ .../svg/sizing/standalone--px-px--px-px.svg | 20 ++ .../sizing/standalone-sanity-height-150px.svg | 8 + .../sizing/standalone-sanity-height-pct.svg | 8 + .../sizing/standalone-sanity-height-px.svg | 8 + .../sizing/standalone-sanity-width-300px.svg | 8 + .../sizing/standalone-sanity-width-pct.svg | 8 + .../svg/sizing/standalone-sanity-width-px.svg | 8 + .../svg/base/src/nsSVGOuterSVGFrame.cpp | 316 ++++++++++++------ .../layout/svg/base/src/nsSVGOuterSVGFrame.h | 20 +- 235 files changed, 6241 insertions(+), 174 deletions(-) create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--object--auto-auto--pct-px.html create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/dynamic--object-svg-unloaded.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-block--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-block--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-inline--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-inline--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-inline-block--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--display-inline-block--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--float-left--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--float-left--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--float-right--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--float-right--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--position-absolute--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--position-absolute--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--position-relative--01-ref.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/inline--position-relative--01.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-0.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-pct--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-pct.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-px--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-px.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-0--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-0.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-pct--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-pct.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-px--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-px.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-0--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-0.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-pct--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-pct.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-px--ref.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-px.html create mode 100755 mozilla/layout/reftests/svg/sizing/object--auto-auto--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/pass-empty.svg create mode 100755 mozilla/layout/reftests/svg/sizing/pass-pct-height-square.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass-pct-pct.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass-pct-px.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass-pct-width-square.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass-px-pct.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass-px-px.xhtml create mode 100755 mozilla/layout/reftests/svg/sizing/pass.svg create mode 100755 mozilla/layout/reftests/svg/sizing/reftest.list create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-0--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-auto--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-pct--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--0-px--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-0--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-auto--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--pct-px--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--px-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-pct--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--pct-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--pct-px--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--px-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--auto-px--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-0--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--pct-px--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--px-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-auto--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-pct--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--pct-px--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-0--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--pct-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--pct-px--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--px-pct--viewBox.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-auto--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-pct--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--0-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--0-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--0-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--pct-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--pct-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--pct-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--px-0.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--px-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone--px-px--px-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-height-150px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-height-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-height-px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-width-300px.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-width-pct.svg create mode 100755 mozilla/layout/reftests/svg/sizing/standalone-sanity-width-px.svg diff --git a/mozilla/content/svg/content/src/nsSVGSVGElement.cpp b/mozilla/content/svg/content/src/nsSVGSVGElement.cpp index e62cd5f8be4..9508e61d42d 100644 --- a/mozilla/content/svg/content/src/nsSVGSVGElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGSVGElement.cpp @@ -1331,28 +1331,6 @@ nsSVGSVGElement::InvalidateTransformNotifyFrame() //---------------------------------------------------------------------- // nsSVGSVGElement -void -nsSVGSVGElement::SetCoordCtxRect(nsIDOMSVGRect* aCtxRect) -{ - if (mLengthAttributes[WIDTH].GetSpecifiedUnitType() == - nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) { - aCtxRect->GetWidth(&mViewportWidth); - mViewportWidth *= - mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() / 100.0f; - } else { - mViewportWidth = mLengthAttributes[WIDTH].GetAnimValue(this); - } - - if (mLengthAttributes[HEIGHT].GetSpecifiedUnitType() == - nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) { - aCtxRect->GetHeight(&mViewportHeight); - mViewportHeight *= - mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() / 100.0f; - } else { - mViewportHeight = mLengthAttributes[HEIGHT].GetAnimValue(this); - } -} - already_AddRefed nsSVGSVGElement::GetCtxRect() { diff --git a/mozilla/content/svg/content/src/nsSVGSVGElement.h b/mozilla/content/svg/content/src/nsSVGSVGElement.h index 00331843bfd..97ae54fb0ec 100644 --- a/mozilla/content/svg/content/src/nsSVGSVGElement.h +++ b/mozilla/content/svg/content/src/nsSVGSVGElement.h @@ -55,6 +55,19 @@ typedef nsSVGStylableElement nsSVGSVGElementBase; +class svgFloatSize { +public: + svgFloatSize(float aWidth, float aHeight) + : width(aWidth) + , height(aHeight) + {} + PRBool operator!=(const svgFloatSize& rhs) { + return width != rhs.width || height != rhs.height; + } + float width; + float height; +}; + class nsSVGSVGElement : public nsSVGSVGElementBase, public nsIDOMSVGSVGElement, public nsIDOMSVGFitToViewBox, @@ -71,9 +84,6 @@ protected: virtual ~nsSVGSVGElement(); nsresult Init(); - // nsSVGSVGElement methods: - void SetCoordCtxRect(nsIDOMSVGRect* aCtxRect); - public: // interfaces: @@ -147,6 +157,15 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + svgFloatSize GetViewportSize() { + return svgFloatSize(mViewportWidth, mViewportHeight); + } + + void SetViewportSize(svgFloatSize& aSize) { + mViewportWidth = aSize.width; + mViewportHeight = aSize.height; + } + protected: // nsSVGElement overrides PRBool IsEventName(nsIAtom* aName); @@ -174,7 +193,16 @@ protected: nsCOMPtr mViewBox; nsCOMPtr mPreserveAspectRatio; - float mViewportWidth, mViewportHeight; // valid only for outersvg + // The size of the rectangular SVG viewport into which we render. This is + // not (necessarily) the same as the content area. See: + // + // http://www.w3.org/TR/SVG11/coords.html#ViewportSpace + // + // XXXjwatt Currently only used for outer , but maybe we could use -1 to + // flag this as an inner to save the overhead of GetCtx calls? + // XXXjwatt our frame should probably reset these when it's destroyed. + float mViewportWidth, mViewportHeight; + float mCoordCtxMmPerPx; // zoom and pan diff --git a/mozilla/layout/base/nsLayoutUtils.cpp b/mozilla/layout/base/nsLayoutUtils.cpp index 7231575dbb8..6d95d510355 100644 --- a/mozilla/layout/base/nsLayoutUtils.cpp +++ b/mozilla/layout/base/nsLayoutUtils.cpp @@ -1734,8 +1734,9 @@ IsAutoHeight(const nsStyleCoord &aCoord, nscoord aCBHeight) /* static */ nsSize nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( - nsIRenderingContext* aRenderingContext, - nsIFrame* aFrame, nsSize aIntrinsicSize, nsSize aCBSize, + nsIRenderingContext* aRenderingContext, nsIFrame* aFrame, + nsIFrame::IntrinsicSize& aIntrinsicSize, + nsSize aIntrinsicRatio, nsSize aCBSize, nsSize aMargin, nsSize aBorder, nsSize aPadding) { const nsStylePosition *stylePos = aFrame->GetStylePosition(); @@ -1812,10 +1813,74 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( minHeight = 0; } + // Resolve percentage intrinsic width/height as necessary: + + NS_ASSERTION(aCBSize.width != NS_UNCONSTRAINEDSIZE, + "Our containing block must not have unconstrained width!"); + + PRBool hasIntrinsicWidth, hasIntrinsicHeight; + nscoord intrinsicWidth, intrinsicHeight; + + if (aIntrinsicSize.width.GetUnit() == eStyleUnit_Coord || + aIntrinsicSize.width.GetUnit() == eStyleUnit_Percent) { + hasIntrinsicWidth = PR_TRUE; + intrinsicWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext, + aFrame, aCBSize.width, 0, boxSizingAdjust.width + + boxSizingToMarginEdgeWidth, aIntrinsicSize.width); + } else { + hasIntrinsicWidth = PR_FALSE; + intrinsicWidth = 0; + } + + if (aIntrinsicSize.height.GetUnit() == eStyleUnit_Coord || + (aIntrinsicSize.height.GetUnit() == eStyleUnit_Percent && + aCBSize.height != NS_AUTOHEIGHT)) { + hasIntrinsicHeight = PR_TRUE; + intrinsicHeight = nsLayoutUtils::ComputeHeightDependentValue( + aRenderingContext, aFrame, aCBSize.height, + aIntrinsicSize.height); + if (intrinsicHeight < 0) + intrinsicHeight = 0; + } else { + hasIntrinsicHeight = PR_FALSE; + intrinsicHeight = 0; + } + + NS_ASSERTION(aIntrinsicRatio.width >= 0 && aIntrinsicRatio.height >= 0, + "Intrinsic ratio has a negative component!"); + + // Now calculate the used values for width and height: + if (isAutoWidth) { if (isAutoHeight) { // 'auto' width, 'auto' height + + // Get tentative values - CSS 2.1 sections 10.3.2 and 10.6.2: + + nscoord tentWidth, tentHeight; + + if (hasIntrinsicWidth) { + tentWidth = intrinsicWidth; + } else if (hasIntrinsicHeight && aIntrinsicRatio.height > 0) { + tentWidth = MULDIV(intrinsicHeight, aIntrinsicRatio.width, aIntrinsicRatio.height); + } else if (aIntrinsicRatio.width > 0) { + tentWidth = aCBSize.width - boxSizingToMarginEdgeWidth; // XXX scrollbar? + if (tentWidth < 0) tentWidth = 0; + } else { + tentWidth = nsPresContext::CSSPixelsToAppUnits(300); + } + + if (hasIntrinsicHeight) { + tentHeight = intrinsicHeight; + } else if (aIntrinsicRatio.width > 0) { + tentHeight = MULDIV(tentWidth, aIntrinsicRatio.height, aIntrinsicRatio.width); + } else { + tentHeight = nsPresContext::CSSPixelsToAppUnits(150); + } + + // Now apply min/max-width/height - CSS 2.1 sections 10.4 and 10.7: + if (minWidth > maxWidth) maxWidth = minWidth; if (minHeight > maxHeight) @@ -1823,68 +1888,77 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( nscoord heightAtMaxWidth, heightAtMinWidth, widthAtMaxHeight, widthAtMinHeight; - if (aIntrinsicSize.width > 0) { - heightAtMaxWidth = MULDIV(maxWidth, aIntrinsicSize.height, aIntrinsicSize.width); + + if (tentWidth > 0) { + heightAtMaxWidth = MULDIV(maxWidth, tentHeight, tentWidth); if (heightAtMaxWidth < minHeight) heightAtMaxWidth = minHeight; - heightAtMinWidth = MULDIV(minWidth, aIntrinsicSize.height, aIntrinsicSize.width); + heightAtMinWidth = MULDIV(minWidth, tentHeight, tentWidth); if (heightAtMinWidth > maxHeight) heightAtMinWidth = maxHeight; } else { - heightAtMaxWidth = aIntrinsicSize.height; - heightAtMinWidth = aIntrinsicSize.height; + heightAtMaxWidth = tentHeight; + heightAtMinWidth = tentHeight; } - if (aIntrinsicSize.height > 0) { - widthAtMaxHeight = MULDIV(maxHeight, aIntrinsicSize.width, aIntrinsicSize.height); + if (tentHeight > 0) { + widthAtMaxHeight = MULDIV(maxHeight, tentWidth, tentHeight); if (widthAtMaxHeight < minWidth) widthAtMaxHeight = minWidth; - widthAtMinHeight = MULDIV(minHeight, aIntrinsicSize.width, aIntrinsicSize.height); + widthAtMinHeight = MULDIV(minHeight, tentWidth, tentHeight); if (widthAtMinHeight > maxWidth) widthAtMinHeight = maxWidth; } else { - widthAtMaxHeight = aIntrinsicSize.width; - widthAtMinHeight = aIntrinsicSize.width; + widthAtMaxHeight = tentWidth; + widthAtMinHeight = tentWidth; } - if (aIntrinsicSize.width > maxWidth) { - if (aIntrinsicSize.height > maxHeight) { - if (PRInt64(maxWidth) * PRInt64(aIntrinsicSize.height) <= - PRInt64(maxHeight) * PRInt64(aIntrinsicSize.width)) { + // The table at http://www.w3.org/TR/CSS21/visudet.html#min-max-widths : + + if (tentWidth > maxWidth) { + if (tentHeight > maxHeight) { + if (PRInt64(maxWidth) * PRInt64(tentHeight) <= + PRInt64(maxHeight) * PRInt64(tentWidth)) { width = maxWidth; height = heightAtMaxWidth; } else { - height = maxHeight; width = widthAtMaxHeight; + height = maxHeight; } } else { + // This also covers "(w > max-width) and (h < min-height)" since in + // that case (max-width/w < 1), and with (h < min-height): + // max(max-width * h/w, min-height) == min-height width = maxWidth; height = heightAtMaxWidth; } - } else if (aIntrinsicSize.width < minWidth) { - if (aIntrinsicSize.height < minHeight) { - if (PRInt64(minWidth) * PRInt64(aIntrinsicSize.height) <= - PRInt64(minHeight) * PRInt64(aIntrinsicSize.width)) { - height = minHeight; + } else if (tentWidth < minWidth) { + if (tentHeight < minHeight) { + if (PRInt64(minWidth) * PRInt64(tentHeight) <= + PRInt64(minHeight) * PRInt64(tentWidth)) { width = widthAtMinHeight; + height = minHeight; } else { width = minWidth; height = heightAtMinWidth; } } else { + // This also covers "(w < min-width) and (h > max-height)" since in + // that case (min-width/w > 1), and with (h > max-height): + // min(min-width * h/w, max-height) == max-height width = minWidth; height = heightAtMinWidth; } } else { - if (aIntrinsicSize.height > maxHeight) { - height = maxHeight; + if (tentHeight > maxHeight) { width = widthAtMaxHeight; - } else if (aIntrinsicSize.height < minHeight) { - height = minHeight; + height = maxHeight; + } else if (tentHeight < minHeight) { width = widthAtMinHeight; + height = minHeight; } else { - width = aIntrinsicSize.width; - height = aIntrinsicSize.height; + width = tentWidth; + height = tentHeight; } } @@ -1892,10 +1966,12 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( // 'auto' width, non-'auto' height height = NS_CSS_MINMAX(height, minHeight, maxHeight); - if (aIntrinsicSize.height != 0) { - width = MULDIV(aIntrinsicSize.width, height, aIntrinsicSize.height); + if (aIntrinsicRatio.height > 0) { + width = MULDIV(height, aIntrinsicRatio.width, aIntrinsicRatio.height); + } else if (hasIntrinsicWidth) { + width = intrinsicWidth; } else { - width = aIntrinsicSize.width; + width = nsPresContext::CSSPixelsToAppUnits(300); } width = NS_CSS_MINMAX(width, minWidth, maxWidth); @@ -1905,18 +1981,20 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( // non-'auto' width, 'auto' height width = NS_CSS_MINMAX(width, minWidth, maxWidth); - if (aIntrinsicSize.width != 0) { - height = MULDIV(aIntrinsicSize.height, width, aIntrinsicSize.width); + if (aIntrinsicRatio.width > 0) { + height = MULDIV(width, aIntrinsicRatio.height, aIntrinsicRatio.width); + } else if (hasIntrinsicHeight) { + height = intrinsicHeight; } else { - height = aIntrinsicSize.height; + height = nsPresContext::CSSPixelsToAppUnits(150); } height = NS_CSS_MINMAX(height, minHeight, maxHeight); } else { // non-'auto' width, non-'auto' height - height = NS_CSS_MINMAX(height, minHeight, maxHeight); width = NS_CSS_MINMAX(width, minWidth, maxWidth); + height = NS_CSS_MINMAX(height, minHeight, maxHeight); } } diff --git a/mozilla/layout/base/nsLayoutUtils.h b/mozilla/layout/base/nsLayoutUtils.h index c733bda29e4..42ad6ad4a0b 100644 --- a/mozilla/layout/base/nsLayoutUtils.h +++ b/mozilla/layout/base/nsLayoutUtils.h @@ -619,9 +619,15 @@ public: nscoord aContainingBlockHeight, const nsStyleCoord& aCoord); + /* + * Calculate the used values for 'width' and 'height' for a replaced element. + * + * http://www.w3.org/TR/CSS21/visudet.html#min-max-widths + */ static nsSize ComputeSizeWithIntrinsicDimensions( - nsIRenderingContext* aRenderingContext, - nsIFrame* aFrame, nsSize aIntrinsicSize, nsSize aCBSize, + nsIRenderingContext* aRenderingContext, nsIFrame* aFrame, + nsIFrame::IntrinsicSize& aIntrinsicSize, + nsSize aIntrinsicRatio, nsSize aCBSize, nsSize aMargin, nsSize aBorder, nsSize aPadding); // Implement nsIFrame::GetPrefWidth in terms of nsIFrame::AddInlinePrefWidth diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 3f49ec1b174..45f67f0c10e 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2943,6 +2943,12 @@ nsFrame::IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext) return result; } +/* virtual */ nsIFrame::IntrinsicSize +nsFrame::GetIntrinsicSize() +{ + return IntrinsicSize(); // default is width/height set to eStyleUnit_None +} + /* virtual */ nsSize nsFrame::GetIntrinsicRatio() { diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index bbb7d4aae66..fba3c81e29a 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -281,6 +281,7 @@ public: InlinePrefWidthData *aData); virtual IntrinsicWidthOffsetData IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext); + virtual IntrinsicSize GetIntrinsicSize(); virtual nsSize GetIntrinsicRatio(); virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext, diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 98ad45804aa..2d7a701e6fa 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -90,6 +90,9 @@ #include "nsDisplayList.h" #include "nsUnicharUtils.h" #include "nsIReflowCallback.h" +#include "nsIScrollableFrame.h" +#include "nsIObjectLoadingContent.h" +#include "nsLayoutUtils.h" // For Accessibility #ifdef ACCESSIBILITY @@ -133,6 +136,16 @@ public: virtual void Destroy(); + virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext); + virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext); + + virtual nsSize GetIntrinsicRatio(); + + virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext, + nsSize aCBSize, nscoord aAvailableWidth, + nsSize aMargin, nsSize aBorder, nsSize aPadding, + PRBool aShrinkWrap); + NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -175,6 +188,16 @@ protected: virtual PRIntn GetSkipSides() const; + /* Obtains the frame we should use for intrinsic size information if we are + * an HTML , or (a replaced element - not