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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 , m_registrationContext(initializer.registrationContext(this)) | 442 , m_registrationContext(initializer.registrationContext(this)) |
443 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi
red) | 443 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi
red) |
444 #ifndef NDEBUG | 444 #ifndef NDEBUG |
445 , m_didDispatchViewportPropertiesChanged(false) | 445 , m_didDispatchViewportPropertiesChanged(false) |
446 #endif | 446 #endif |
447 , m_animationClock(AnimationClock::create()) | 447 , m_animationClock(AnimationClock::create()) |
448 , m_timeline(DocumentTimeline::create(this)) | 448 , m_timeline(DocumentTimeline::create(this)) |
449 , m_transitionTimeline(TransitionTimeline::create(this)) | 449 , m_transitionTimeline(TransitionTimeline::create(this)) |
450 , m_templateDocumentHost(0) | 450 , m_templateDocumentHost(0) |
451 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 451 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 452 , m_hasViewportUnits(false) |
452 { | 453 { |
453 setClient(this); | 454 setClient(this); |
454 ScriptWrappable::init(this); | 455 ScriptWrappable::init(this); |
455 | 456 |
456 if (m_frame) { | 457 if (m_frame) { |
457 provideContextFeaturesToDocumentFrom(this, m_frame->page()); | 458 provideContextFeaturesToDocumentFrom(this, m_frame->page()); |
458 | 459 |
459 m_fetcher = m_frame->loader().activeDocumentLoader()->fetcher(); | 460 m_fetcher = m_frame->loader().activeDocumentLoader()->fetcher(); |
460 } | 461 } |
461 | 462 |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 } | 1875 } |
1875 | 1876 |
1876 bool Document::isPageBoxVisible(int pageIndex) | 1877 bool Document::isPageBoxVisible(int pageIndex) |
1877 { | 1878 { |
1878 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. | 1879 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. |
1879 } | 1880 } |
1880 | 1881 |
1881 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1882 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
1882 { | 1883 { |
1883 RefPtr<RenderStyle> style = styleForPage(pageIndex); | 1884 RefPtr<RenderStyle> style = styleForPage(pageIndex); |
1884 RenderView* view = renderView(); | |
1885 | 1885 |
1886 int width = pageSize.width(); | 1886 int width = pageSize.width(); |
1887 int height = pageSize.height(); | 1887 int height = pageSize.height(); |
1888 switch (style->pageSizeType()) { | 1888 switch (style->pageSizeType()) { |
1889 case PAGE_SIZE_AUTO: | 1889 case PAGE_SIZE_AUTO: |
1890 break; | 1890 break; |
1891 case PAGE_SIZE_AUTO_LANDSCAPE: | 1891 case PAGE_SIZE_AUTO_LANDSCAPE: |
1892 if (width < height) | 1892 if (width < height) |
1893 std::swap(width, height); | 1893 std::swap(width, height); |
1894 break; | 1894 break; |
1895 case PAGE_SIZE_AUTO_PORTRAIT: | 1895 case PAGE_SIZE_AUTO_PORTRAIT: |
1896 if (width > height) | 1896 if (width > height) |
1897 std::swap(width, height); | 1897 std::swap(width, height); |
1898 break; | 1898 break; |
1899 case PAGE_SIZE_RESOLVED: { | 1899 case PAGE_SIZE_RESOLVED: { |
1900 LengthSize size = style->pageSize(); | 1900 LengthSize size = style->pageSize(); |
1901 ASSERT(size.width().isFixed()); | 1901 ASSERT(size.width().isFixed()); |
1902 ASSERT(size.height().isFixed()); | 1902 ASSERT(size.height().isFixed()); |
1903 width = valueForLength(size.width(), 0, view); | 1903 width = valueForLength(size.width(), 0); |
1904 height = valueForLength(size.height(), 0, view); | 1904 height = valueForLength(size.height(), 0); |
1905 break; | 1905 break; |
1906 } | 1906 } |
1907 default: | 1907 default: |
1908 ASSERT_NOT_REACHED(); | 1908 ASSERT_NOT_REACHED(); |
1909 } | 1909 } |
1910 pageSize = IntSize(width, height); | 1910 pageSize = IntSize(width, height); |
1911 | 1911 |
1912 // The percentage is calculated with respect to the width even for margin to
p and bottom. | 1912 // The percentage is calculated with respect to the width even for margin to
p and bottom. |
1913 // http://www.w3.org/TR/CSS2/box.html#margin-properties | 1913 // http://www.w3.org/TR/CSS2/box.html#margin-properties |
1914 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width, view); | 1914 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width); |
1915 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width, view); | 1915 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width); |
1916 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width, view); | 1916 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width); |
1917 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width, view); | 1917 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width); |
1918 } | 1918 } |
1919 | 1919 |
1920 void Document::setIsViewSource(bool isViewSource) | 1920 void Document::setIsViewSource(bool isViewSource) |
1921 { | 1921 { |
1922 m_isViewSource = isViewSource; | 1922 m_isViewSource = isViewSource; |
1923 if (!m_isViewSource) | 1923 if (!m_isViewSource) |
1924 return; | 1924 return; |
1925 | 1925 |
1926 setSecurityOrigin(SecurityOrigin::createUnique()); | 1926 setSecurityOrigin(SecurityOrigin::createUnique()); |
1927 didUpdateSecurityOrigin(); | 1927 didUpdateSecurityOrigin(); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 m_styleEngine->setSelectedStylesheetSetName(aString); | 3163 m_styleEngine->setSelectedStylesheetSetName(aString); |
3164 styleResolverChanged(RecalcStyleDeferred); | 3164 styleResolverChanged(RecalcStyleDeferred); |
3165 } | 3165 } |
3166 | 3166 |
3167 void Document::evaluateMediaQueryList() | 3167 void Document::evaluateMediaQueryList() |
3168 { | 3168 { |
3169 if (m_mediaQueryMatcher) | 3169 if (m_mediaQueryMatcher) |
3170 m_mediaQueryMatcher->styleResolverChanged(); | 3170 m_mediaQueryMatcher->styleResolverChanged(); |
3171 } | 3171 } |
3172 | 3172 |
| 3173 void Document::notifyResizeForViewportUnits() |
| 3174 { |
| 3175 if (!hasViewportUnits()) |
| 3176 return; |
| 3177 ensureStyleResolver().notifyResizeForViewportUnits(); |
| 3178 setNeedsStyleRecalcForViewportUnits(); |
| 3179 } |
| 3180 |
3173 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd
ateMode updateMode) | 3181 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd
ateMode updateMode) |
3174 { | 3182 { |
3175 // styleResolverChanged() can be invoked during Document destruction. | 3183 // styleResolverChanged() can be invoked during Document destruction. |
3176 // We just skip that case. | 3184 // We just skip that case. |
3177 if (!m_styleEngine) | 3185 if (!m_styleEngine) |
3178 return; | 3186 return; |
3179 | 3187 |
3180 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda
teMode); | 3188 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda
teMode); |
3181 if (change.needsRepaint()) { | 3189 if (change.needsRepaint()) { |
3182 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3190 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5232 } | 5240 } |
5233 | 5241 |
5234 FastTextAutosizer* Document::fastTextAutosizer() | 5242 FastTextAutosizer* Document::fastTextAutosizer() |
5235 { | 5243 { |
5236 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5244 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5237 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5245 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5238 return m_fastTextAutosizer.get(); | 5246 return m_fastTextAutosizer.get(); |
5239 } | 5247 } |
5240 | 5248 |
5241 } // namespace WebCore | 5249 } // namespace WebCore |
OLD | NEW |