| 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 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 FontBuilder fontBuilder(*this); | 1621 FontBuilder fontBuilder(*this); |
| 1622 RefPtrWillBeRawPtr<CSSFontSelector> selector = m_styleEngine->fontSelector()
; | 1622 RefPtrWillBeRawPtr<CSSFontSelector> selector = m_styleEngine->fontSelector()
; |
| 1623 fontBuilder.createFontForDocument(selector, documentStyle); | 1623 fontBuilder.createFontForDocument(selector, documentStyle); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) | 1626 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) |
| 1627 { | 1627 { |
| 1628 ASSERT(inStyleRecalc()); | 1628 ASSERT(inStyleRecalc()); |
| 1629 ASSERT(documentElement()); | 1629 ASSERT(documentElement()); |
| 1630 | 1630 |
| 1631 RefPtr<LayoutStyle> documentElementStyle = documentElement()->layoutStyle(); | 1631 RefPtr<LayoutStyle> documentElementStyle = documentElement()->mutableLayoutS
tyle(); |
| 1632 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) | 1632 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) |
| 1633 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); | 1633 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); |
| 1634 | 1634 |
| 1635 WritingMode rootWritingMode = documentElementStyle->writingMode(); | 1635 WritingMode rootWritingMode = documentElementStyle->writingMode(); |
| 1636 TextDirection rootDirection = documentElementStyle->direction(); | 1636 TextDirection rootDirection = documentElementStyle->direction(); |
| 1637 | 1637 |
| 1638 HTMLElement* body = this->body(); | 1638 HTMLElement* body = this->body(); |
| 1639 RefPtr<LayoutStyle> bodyStyle; | 1639 RefPtr<LayoutStyle> bodyStyle; |
| 1640 if (body) { | 1640 if (body) { |
| 1641 bodyStyle = body->layoutStyle(); | 1641 bodyStyle = body->mutableLayoutStyle(); |
| 1642 if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsSt
yleRecalc() || change == Force) | 1642 if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsSt
yleRecalc() || change == Force) |
| 1643 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1643 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
| 1644 rootWritingMode = bodyStyle->writingMode(); | 1644 rootWritingMode = bodyStyle->writingMode(); |
| 1645 rootDirection = bodyStyle->direction(); | 1645 rootDirection = bodyStyle->direction(); |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 RefPtr<LayoutStyle> overflowStyle; | 1648 RefPtr<LayoutStyle> overflowStyle; |
| 1649 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1649 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
| 1650 if (element == body) { | 1650 if (element == body) { |
| 1651 overflowStyle = bodyStyle; | 1651 overflowStyle = bodyStyle; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1678 overflowX = OAUTO; | 1678 overflowX = OAUTO; |
| 1679 if (overflowY == OVISIBLE) | 1679 if (overflowY == OVISIBLE) |
| 1680 overflowY = OAUTO; | 1680 overflowY = OAUTO; |
| 1681 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1681 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
| 1682 // ways to specify gaps between pages), so we have to propagate it too. | 1682 // ways to specify gaps between pages), so we have to propagate it too. |
| 1683 columnGap = overflowStyle->columnGap(); | 1683 columnGap = overflowStyle->columnGap(); |
| 1684 } | 1684 } |
| 1685 | 1685 |
| 1686 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); | 1686 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); |
| 1687 | 1687 |
| 1688 RefPtr<LayoutStyle> documentStyle = renderView()->style(); | 1688 RefPtr<LayoutStyle> documentStyle = renderView()->mutableStyle(); |
| 1689 if (documentStyle->writingMode() != rootWritingMode | 1689 if (documentStyle->writingMode() != rootWritingMode |
| 1690 || documentStyle->direction() != rootDirection | 1690 || documentStyle->direction() != rootDirection |
| 1691 || documentStyle->overflowX() != overflowX | 1691 || documentStyle->overflowX() != overflowX |
| 1692 || documentStyle->overflowY() != overflowY | 1692 || documentStyle->overflowY() != overflowY |
| 1693 || documentStyle->columnGap() != columnGap | 1693 || documentStyle->columnGap() != columnGap |
| 1694 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { | 1694 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { |
| 1695 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(*documentStyle); | 1695 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(*documentStyle); |
| 1696 newStyle->setWritingMode(rootWritingMode); | 1696 newStyle->setWritingMode(rootWritingMode); |
| 1697 newStyle->setDirection(rootDirection); | 1697 newStyle->setDirection(rootDirection); |
| 1698 newStyle->setColumnGap(columnGap); | 1698 newStyle->setColumnGap(columnGap); |
| 1699 newStyle->setOverflowX(overflowX); | 1699 newStyle->setOverflowX(overflowX); |
| 1700 newStyle->setOverflowY(overflowY); | 1700 newStyle->setOverflowY(overflowY); |
| 1701 newStyle->setScrollBlocksOn(scrollBlocksOn); | 1701 newStyle->setScrollBlocksOn(scrollBlocksOn); |
| 1702 renderView()->setStyle(newStyle); | 1702 renderView()->setStyle(newStyle); |
| 1703 setupFontBuilder(*newStyle); | 1703 setupFontBuilder(*newStyle); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 if (body) { | 1706 if (body) { |
| 1707 if (LayoutStyle* style = body->layoutStyle()) { | 1707 if (const LayoutStyle* style = body->layoutStyle()) { |
| 1708 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1708 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
| 1709 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1709 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1710 } | 1710 } |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 if (LayoutStyle* style = documentElement()->layoutStyle()) { | 1713 if (const LayoutStyle* style = documentElement()->layoutStyle()) { |
| 1714 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1714 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) |
| 1715 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); | 1715 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); |
| 1716 } | 1716 } |
| 1717 } | 1717 } |
| 1718 | 1718 |
| 1719 void Document::updateRenderTree(StyleRecalcChange change) | 1719 void Document::updateRenderTree(StyleRecalcChange change) |
| 1720 { | 1720 { |
| 1721 ASSERT(isMainThread()); | 1721 ASSERT(isMainThread()); |
| 1722 | 1722 |
| 1723 ScriptForbiddenScope forbidScript; | 1723 ScriptForbiddenScope forbidScript; |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 | 2401 |
| 2402 HTMLHeadElement* Document::head() const | 2402 HTMLHeadElement* Document::head() const |
| 2403 { | 2403 { |
| 2404 Node* de = documentElement(); | 2404 Node* de = documentElement(); |
| 2405 if (!de) | 2405 if (!de) |
| 2406 return 0; | 2406 return 0; |
| 2407 | 2407 |
| 2408 return Traversal<HTMLHeadElement>::firstChild(*de); | 2408 return Traversal<HTMLHeadElement>::firstChild(*de); |
| 2409 } | 2409 } |
| 2410 | 2410 |
| 2411 Element* Document::viewportDefiningElement(LayoutStyle* rootStyle) const | 2411 Element* Document::viewportDefiningElement(const LayoutStyle* rootStyle) const |
| 2412 { | 2412 { |
| 2413 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long | 2413 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long |
| 2414 // as the following conditions are all met: | 2414 // as the following conditions are all met: |
| 2415 // (1) The root element is HTML. | 2415 // (1) The root element is HTML. |
| 2416 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). | 2416 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). |
| 2417 // (3) The root element has visible overflow. | 2417 // (3) The root element has visible overflow. |
| 2418 // Otherwise it's the root element's properties that are to be propagated. | 2418 // Otherwise it's the root element's properties that are to be propagated. |
| 2419 Element* rootElement = documentElement(); | 2419 Element* rootElement = documentElement(); |
| 2420 Element* bodyElement = body(); | 2420 Element* bodyElement = body(); |
| 2421 if (!rootElement) | 2421 if (!rootElement) |
| (...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 } | 4197 } |
| 4198 | 4198 |
| 4199 m_encodingData = newData; | 4199 m_encodingData = newData; |
| 4200 | 4200 |
| 4201 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | 4201 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
| 4202 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | 4202 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
| 4203 if (shouldUseVisualOrdering != m_visuallyOrdered) { | 4203 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 4204 m_visuallyOrdered = shouldUseVisualOrdering; | 4204 m_visuallyOrdered = shouldUseVisualOrdering; |
| 4205 // FIXME: How is possible to not have a renderer here? | 4205 // FIXME: How is possible to not have a renderer here? |
| 4206 if (renderView()) | 4206 if (renderView()) |
| 4207 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); | 4207 renderView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V
isualOrder : LogicalOrder); |
| 4208 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); | 4208 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); |
| 4209 } | 4209 } |
| 4210 } | 4210 } |
| 4211 | 4211 |
| 4212 KURL Document::completeURL(const String& url) const | 4212 KURL Document::completeURL(const String& url) const |
| 4213 { | 4213 { |
| 4214 return completeURLWithOverride(url, m_baseURL); | 4214 return completeURLWithOverride(url, m_baseURL); |
| 4215 } | 4215 } |
| 4216 | 4216 |
| 4217 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4217 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5741 #ifndef NDEBUG | 5741 #ifndef NDEBUG |
| 5742 using namespace blink; | 5742 using namespace blink; |
| 5743 void showLiveDocumentInstances() | 5743 void showLiveDocumentInstances() |
| 5744 { | 5744 { |
| 5745 WeakDocumentSet& set = liveDocumentSet(); | 5745 WeakDocumentSet& set = liveDocumentSet(); |
| 5746 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5746 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5747 for (Document* document : set) | 5747 for (Document* document : set) |
| 5748 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5748 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5749 } | 5749 } |
| 5750 #endif | 5750 #endif |
| OLD | NEW |