OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 { | 1987 { |
1988 updateDistribution(); | 1988 updateDistribution(); |
1989 return ensureStyleResolver().styleForPage(pageIndex); | 1989 return ensureStyleResolver().styleForPage(pageIndex); |
1990 } | 1990 } |
1991 | 1991 |
1992 bool Document::isPageBoxVisible(int pageIndex) | 1992 bool Document::isPageBoxVisible(int pageIndex) |
1993 { | 1993 { |
1994 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. | 1994 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. |
1995 } | 1995 } |
1996 | 1996 |
1997 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1997 void Document::pageSizeAndMarginsInPixels(int pageIndex, FloatSize& pageSize, in
t& marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
1998 { | 1998 { |
1999 RefPtr<ComputedStyle> style = styleForPage(pageIndex); | 1999 RefPtr<ComputedStyle> style = styleForPage(pageIndex); |
2000 | 2000 |
2001 int width = pageSize.width(); | 2001 float width = pageSize.width(); |
2002 int height = pageSize.height(); | 2002 float height = pageSize.height(); |
2003 switch (style->getPageSizeType()) { | 2003 switch (style->getPageSizeType()) { |
2004 case PAGE_SIZE_AUTO: | 2004 case PAGE_SIZE_AUTO: |
2005 break; | 2005 break; |
2006 case PAGE_SIZE_AUTO_LANDSCAPE: | 2006 case PAGE_SIZE_AUTO_LANDSCAPE: |
2007 if (width < height) | 2007 if (width < height) |
2008 std::swap(width, height); | 2008 std::swap(width, height); |
2009 break; | 2009 break; |
2010 case PAGE_SIZE_AUTO_PORTRAIT: | 2010 case PAGE_SIZE_AUTO_PORTRAIT: |
2011 if (width > height) | 2011 if (width > height) |
2012 std::swap(width, height); | 2012 std::swap(width, height); |
2013 break; | 2013 break; |
2014 case PAGE_SIZE_RESOLVED: { | 2014 case PAGE_SIZE_RESOLVED: { |
2015 FloatSize size = style->pageSize(); | 2015 FloatSize size = style->pageSize(); |
2016 width = size.width(); | 2016 width = size.width(); |
2017 height = size.height(); | 2017 height = size.height(); |
2018 break; | 2018 break; |
2019 } | 2019 } |
2020 default: | 2020 default: |
2021 ASSERT_NOT_REACHED(); | 2021 ASSERT_NOT_REACHED(); |
2022 } | 2022 } |
2023 pageSize = IntSize(width, height); | 2023 pageSize = FloatSize(width, height); |
2024 | 2024 |
2025 // The percentage is calculated with respect to the width even for margin to
p and bottom. | 2025 // The percentage is calculated with respect to the width even for margin to
p and bottom. |
2026 // http://www.w3.org/TR/CSS2/box.html#margin-properties | 2026 // http://www.w3.org/TR/CSS2/box.html#margin-properties |
2027 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width); | 2027 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width); |
2028 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width); | 2028 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width); |
2029 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width); | 2029 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width); |
2030 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width); | 2030 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width); |
2031 } | 2031 } |
2032 | 2032 |
2033 void Document::setIsViewSource(bool isViewSource) | 2033 void Document::setIsViewSource(bool isViewSource) |
(...skipping 3988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6022 } | 6022 } |
6023 | 6023 |
6024 void showLiveDocumentInstances() | 6024 void showLiveDocumentInstances() |
6025 { | 6025 { |
6026 WeakDocumentSet& set = liveDocumentSet(); | 6026 WeakDocumentSet& set = liveDocumentSet(); |
6027 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6027 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6028 for (Document* document : set) | 6028 for (Document* document : set) |
6029 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6029 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
6030 } | 6030 } |
6031 #endif | 6031 #endif |
OLD | NEW |