Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use DEFINE_STATIC_LOCAL on Lengths to avoid exit time destructors
https://bugs.webkit.org/show_bug.cgi?id=80561

Reviewed by Eric Seidel.

This is in preparation for http://wkb.ug/79621 where a destructor is added to Length.

No new tests as this is not a behaviour change.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyPageSize::getPageSizeFromName):


Canonical link: https://commits.webkit.org/97750@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mikelawther committed Mar 8, 2012
1 parent cb2746a commit c4dbc13
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
2012-03-07 Mike Lawther <mikelawther@chromium.org>

use DEFINE_STATIC_LOCAL on Lengths to avoid exit time destructors
https://bugs.webkit.org/show_bug.cgi?id=80561

Reviewed by Eric Seidel.

This is in preparation for http://wkb.ug/79621 where a destructor is added to Length.

No new tests as this is not a behaviour change.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyPageSize::getPageSizeFromName):

2012-03-07 Adam Barth <abarth@webkit.org>

ContainerNode::willRemove uses a weak iteration pattern
Expand Down
24 changes: 16 additions & 8 deletions Source/WebCore/css/CSSStyleApplyProperty.cpp
Expand Up @@ -1216,14 +1216,22 @@ class ApplyPropertyPageSize {
static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
{
static const Length a5Width = mmLength(148), a5Height = mmLength(210);
static const Length a4Width = mmLength(210), a4Height = mmLength(297);
static const Length a3Width = mmLength(297), a3Height = mmLength(420);
static const Length b5Width = mmLength(176), b5Height = mmLength(250);
static const Length b4Width = mmLength(250), b4Height = mmLength(353);
static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11);
static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14);
static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17);
DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));

if (!pageSizeName)
return false;
Expand Down

0 comments on commit c4dbc13

Please sign in to comment.