| 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 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 | 1573 |
| 1574 bool didRecalcDocumentElement = false; | 1574 bool didRecalcDocumentElement = false; |
| 1575 RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableCompu
tedStyle(); | 1575 RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableCompu
tedStyle(); |
| 1576 if (change == Force) | 1576 if (change == Force) |
| 1577 documentElement()->clearAnimationStyleChange(); | 1577 documentElement()->clearAnimationStyleChange(); |
| 1578 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { | 1578 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { |
| 1579 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); | 1579 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); |
| 1580 didRecalcDocumentElement = true; | 1580 didRecalcDocumentElement = true; |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 WritingMode rootWritingMode = documentElementStyle->writingMode(); | 1583 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); |
| 1584 TextDirection rootDirection = documentElementStyle->direction(); | 1584 TextDirection rootDirection = documentElementStyle->direction(); |
| 1585 | 1585 |
| 1586 HTMLElement* body = this->body(); | 1586 HTMLElement* body = this->body(); |
| 1587 RefPtr<ComputedStyle> bodyStyle; | 1587 RefPtr<ComputedStyle> bodyStyle; |
| 1588 | 1588 |
| 1589 if (body) { | 1589 if (body) { |
| 1590 bodyStyle = body->mutableComputedStyle(); | 1590 bodyStyle = body->mutableComputedStyle(); |
| 1591 if (didRecalcDocumentElement) | 1591 if (didRecalcDocumentElement) |
| 1592 body->clearAnimationStyleChange(); | 1592 body->clearAnimationStyleChange(); |
| 1593 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1593 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) |
| 1594 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1594 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
| 1595 rootWritingMode = bodyStyle->writingMode(); | 1595 rootWritingMode = bodyStyle->getWritingMode(); |
| 1596 rootDirection = bodyStyle->direction(); | 1596 rootDirection = bodyStyle->direction(); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 const ComputedStyle* backgroundStyle = documentElementStyle.get(); | 1599 const ComputedStyle* backgroundStyle = documentElementStyle.get(); |
| 1600 // http://www.w3.org/TR/css3-background/#body-background | 1600 // http://www.w3.org/TR/css3-background/#body-background |
| 1601 // <html> root element with no background steals background from its first <
body> child. | 1601 // <html> root element with no background steals background from its first <
body> child. |
| 1602 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() | 1602 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() |
| 1603 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !back
groundStyle->hasBackground()) | 1603 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !back
groundStyle->hasBackground()) |
| 1604 backgroundStyle = bodyStyle.get(); | 1604 backgroundStyle = bodyStyle.get(); |
| 1605 Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBa
ckgroundColor); | 1605 Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBa
ckgroundColor); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 if (overflowX == OVISIBLE) | 1655 if (overflowX == OVISIBLE) |
| 1656 overflowX = OAUTO; | 1656 overflowX = OAUTO; |
| 1657 if (overflowY == OVISIBLE) | 1657 if (overflowY == OVISIBLE) |
| 1658 overflowY = OAUTO; | 1658 overflowY = OAUTO; |
| 1659 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1659 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
| 1660 // ways to specify gaps between pages), so we have to propagate it too. | 1660 // ways to specify gaps between pages), so we have to propagate it too. |
| 1661 columnGap = overflowStyle->columnGap(); | 1661 columnGap = overflowStyle->columnGap(); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); | 1664 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); |
| 1665 if (documentStyle->writingMode() != rootWritingMode | 1665 if (documentStyle->getWritingMode() != rootWritingMode |
| 1666 || documentStyle->direction() != rootDirection | 1666 || documentStyle->direction() != rootDirection |
| 1667 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b
ackgroundColor | 1667 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b
ackgroundColor |
| 1668 || documentStyle->backgroundLayers() != backgroundLayers | 1668 || documentStyle->backgroundLayers() != backgroundLayers |
| 1669 || documentStyle->imageRendering() != imageRendering | 1669 || documentStyle->imageRendering() != imageRendering |
| 1670 || documentStyle->overflowX() != overflowX | 1670 || documentStyle->overflowX() != overflowX |
| 1671 || documentStyle->overflowY() != overflowY | 1671 || documentStyle->overflowY() != overflowY |
| 1672 || documentStyle->columnGap() != columnGap) { | 1672 || documentStyle->columnGap() != columnGap) { |
| 1673 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); | 1673 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); |
| 1674 newStyle->setWritingMode(rootWritingMode); | 1674 newStyle->setWritingMode(rootWritingMode); |
| 1675 newStyle->setDirection(rootDirection); | 1675 newStyle->setDirection(rootDirection); |
| 1676 newStyle->setBackgroundColor(backgroundColor); | 1676 newStyle->setBackgroundColor(backgroundColor); |
| 1677 newStyle->accessBackgroundLayers() = backgroundLayers; | 1677 newStyle->accessBackgroundLayers() = backgroundLayers; |
| 1678 newStyle->setImageRendering(imageRendering); | 1678 newStyle->setImageRendering(imageRendering); |
| 1679 newStyle->setOverflowX(overflowX); | 1679 newStyle->setOverflowX(overflowX); |
| 1680 newStyle->setOverflowY(overflowY); | 1680 newStyle->setOverflowY(overflowY); |
| 1681 newStyle->setColumnGap(columnGap); | 1681 newStyle->setColumnGap(columnGap); |
| 1682 layoutView()->setStyle(newStyle); | 1682 layoutView()->setStyle(newStyle); |
| 1683 setupFontBuilder(*newStyle); | 1683 setupFontBuilder(*newStyle); |
| 1684 } | 1684 } |
| 1685 | 1685 |
| 1686 if (body) { | 1686 if (body) { |
| 1687 if (const ComputedStyle* style = body->computedStyle()) { | 1687 if (const ComputedStyle* style = body->computedStyle()) { |
| 1688 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1688 if (style->direction() != rootDirection || style->getWritingMode() !
= rootWritingMode) |
| 1689 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1689 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1690 } | 1690 } |
| 1691 } | 1691 } |
| 1692 | 1692 |
| 1693 if (const ComputedStyle* style = documentElement()->computedStyle()) { | 1693 if (const ComputedStyle* style = documentElement()->computedStyle()) { |
| 1694 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1694 if (style->direction() != rootDirection || style->getWritingMode() != ro
otWritingMode) |
| 1695 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); | 1695 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); |
| 1696 } | 1696 } |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 #if ENABLE(ASSERT) | 1699 #if ENABLE(ASSERT) |
| 1700 static void assertLayoutTreeUpdated(Node& root) | 1700 static void assertLayoutTreeUpdated(Node& root) |
| 1701 { | 1701 { |
| 1702 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 1702 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 1703 // We leave some nodes with dirty bits in the tree because they don't | 1703 // We leave some nodes with dirty bits in the tree because they don't |
| 1704 // matter like Comment and ProcessingInstruction nodes. | 1704 // matter like Comment and ProcessingInstruction nodes. |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 { | 2050 { |
| 2051 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. | 2051 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. |
| 2052 } | 2052 } |
| 2053 | 2053 |
| 2054 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 2054 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
| 2055 { | 2055 { |
| 2056 RefPtr<ComputedStyle> style = styleForPage(pageIndex); | 2056 RefPtr<ComputedStyle> style = styleForPage(pageIndex); |
| 2057 | 2057 |
| 2058 int width = pageSize.width(); | 2058 int width = pageSize.width(); |
| 2059 int height = pageSize.height(); | 2059 int height = pageSize.height(); |
| 2060 switch (style->pageSizeType()) { | 2060 switch (style->getPageSizeType()) { |
| 2061 case PAGE_SIZE_AUTO: | 2061 case PAGE_SIZE_AUTO: |
| 2062 break; | 2062 break; |
| 2063 case PAGE_SIZE_AUTO_LANDSCAPE: | 2063 case PAGE_SIZE_AUTO_LANDSCAPE: |
| 2064 if (width < height) | 2064 if (width < height) |
| 2065 std::swap(width, height); | 2065 std::swap(width, height); |
| 2066 break; | 2066 break; |
| 2067 case PAGE_SIZE_AUTO_PORTRAIT: | 2067 case PAGE_SIZE_AUTO_PORTRAIT: |
| 2068 if (width > height) | 2068 if (width > height) |
| 2069 std::swap(width, height); | 2069 std::swap(width, height); |
| 2070 break; | 2070 break; |
| (...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5995 #ifndef NDEBUG | 5995 #ifndef NDEBUG |
| 5996 using namespace blink; | 5996 using namespace blink; |
| 5997 void showLiveDocumentInstances() | 5997 void showLiveDocumentInstances() |
| 5998 { | 5998 { |
| 5999 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5999 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 6000 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6000 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6001 for (Document* document : set) | 6001 for (Document* document : set) |
| 6002 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 6002 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 6003 } | 6003 } |
| 6004 #endif | 6004 #endif |
| OLD | NEW |