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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 , m_registrationContext(initializer.registrationContext(this)) | 443 , m_registrationContext(initializer.registrationContext(this)) |
444 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi
red) | 444 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi
red) |
445 #ifndef NDEBUG | 445 #ifndef NDEBUG |
446 , m_didDispatchViewportPropertiesChanged(false) | 446 , m_didDispatchViewportPropertiesChanged(false) |
447 #endif | 447 #endif |
448 , m_animationClock(AnimationClock::create()) | 448 , m_animationClock(AnimationClock::create()) |
449 , m_timeline(DocumentTimeline::create(this)) | 449 , m_timeline(DocumentTimeline::create(this)) |
450 , m_transitionTimeline(TransitionTimeline::create(this)) | 450 , m_transitionTimeline(TransitionTimeline::create(this)) |
451 , m_templateDocumentHost(0) | 451 , m_templateDocumentHost(0) |
452 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 452 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 453 , m_hasViewportUnits(false) |
453 { | 454 { |
454 setClient(this); | 455 setClient(this); |
455 ScriptWrappable::init(this); | 456 ScriptWrappable::init(this); |
456 | 457 |
457 if (m_frame) { | 458 if (m_frame) { |
458 provideContextFeaturesToDocumentFrom(this, m_frame->page()); | 459 provideContextFeaturesToDocumentFrom(this, m_frame->page()); |
459 | 460 |
460 m_fetcher = m_frame->loader().activeDocumentLoader()->fetcher(); | 461 m_fetcher = m_frame->loader().activeDocumentLoader()->fetcher(); |
461 } | 462 } |
462 | 463 |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 } | 1888 } |
1888 | 1889 |
1889 bool Document::isPageBoxVisible(int pageIndex) | 1890 bool Document::isPageBoxVisible(int pageIndex) |
1890 { | 1891 { |
1891 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. | 1892 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. |
1892 } | 1893 } |
1893 | 1894 |
1894 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1895 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
1895 { | 1896 { |
1896 RefPtr<RenderStyle> style = styleForPage(pageIndex); | 1897 RefPtr<RenderStyle> style = styleForPage(pageIndex); |
1897 RenderView* view = renderView(); | |
1898 | 1898 |
1899 int width = pageSize.width(); | 1899 int width = pageSize.width(); |
1900 int height = pageSize.height(); | 1900 int height = pageSize.height(); |
1901 switch (style->pageSizeType()) { | 1901 switch (style->pageSizeType()) { |
1902 case PAGE_SIZE_AUTO: | 1902 case PAGE_SIZE_AUTO: |
1903 break; | 1903 break; |
1904 case PAGE_SIZE_AUTO_LANDSCAPE: | 1904 case PAGE_SIZE_AUTO_LANDSCAPE: |
1905 if (width < height) | 1905 if (width < height) |
1906 std::swap(width, height); | 1906 std::swap(width, height); |
1907 break; | 1907 break; |
1908 case PAGE_SIZE_AUTO_PORTRAIT: | 1908 case PAGE_SIZE_AUTO_PORTRAIT: |
1909 if (width > height) | 1909 if (width > height) |
1910 std::swap(width, height); | 1910 std::swap(width, height); |
1911 break; | 1911 break; |
1912 case PAGE_SIZE_RESOLVED: { | 1912 case PAGE_SIZE_RESOLVED: { |
1913 LengthSize size = style->pageSize(); | 1913 LengthSize size = style->pageSize(); |
1914 ASSERT(size.width().isFixed()); | 1914 ASSERT(size.width().isFixed()); |
1915 ASSERT(size.height().isFixed()); | 1915 ASSERT(size.height().isFixed()); |
1916 width = valueForLength(size.width(), 0, view); | 1916 width = valueForLength(size.width(), 0); |
1917 height = valueForLength(size.height(), 0, view); | 1917 height = valueForLength(size.height(), 0); |
1918 break; | 1918 break; |
1919 } | 1919 } |
1920 default: | 1920 default: |
1921 ASSERT_NOT_REACHED(); | 1921 ASSERT_NOT_REACHED(); |
1922 } | 1922 } |
1923 pageSize = IntSize(width, height); | 1923 pageSize = IntSize(width, height); |
1924 | 1924 |
1925 // The percentage is calculated with respect to the width even for margin to
p and bottom. | 1925 // The percentage is calculated with respect to the width even for margin to
p and bottom. |
1926 // http://www.w3.org/TR/CSS2/box.html#margin-properties | 1926 // http://www.w3.org/TR/CSS2/box.html#margin-properties |
1927 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width, view); | 1927 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl
e->marginTop(), width); |
1928 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width, view); | 1928 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt
h(style->marginRight(), width); |
1929 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width, view); | 1929 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe
ngth(style->marginBottom(), width); |
1930 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width, view); | 1930 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s
tyle->marginLeft(), width); |
1931 } | 1931 } |
1932 | 1932 |
1933 void Document::setIsViewSource(bool isViewSource) | 1933 void Document::setIsViewSource(bool isViewSource) |
1934 { | 1934 { |
1935 m_isViewSource = isViewSource; | 1935 m_isViewSource = isViewSource; |
1936 if (!m_isViewSource) | 1936 if (!m_isViewSource) |
1937 return; | 1937 return; |
1938 | 1938 |
1939 setSecurityOrigin(SecurityOrigin::createUnique()); | 1939 setSecurityOrigin(SecurityOrigin::createUnique()); |
1940 didUpdateSecurityOrigin(); | 1940 didUpdateSecurityOrigin(); |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 m_styleEngine->setSelectedStylesheetSetName(aString); | 3188 m_styleEngine->setSelectedStylesheetSetName(aString); |
3189 styleResolverChanged(RecalcStyleDeferred); | 3189 styleResolverChanged(RecalcStyleDeferred); |
3190 } | 3190 } |
3191 | 3191 |
3192 void Document::evaluateMediaQueryList() | 3192 void Document::evaluateMediaQueryList() |
3193 { | 3193 { |
3194 if (m_mediaQueryMatcher) | 3194 if (m_mediaQueryMatcher) |
3195 m_mediaQueryMatcher->styleResolverChanged(); | 3195 m_mediaQueryMatcher->styleResolverChanged(); |
3196 } | 3196 } |
3197 | 3197 |
| 3198 void Document::notifyResizeForViewportUnits() |
| 3199 { |
| 3200 if (!hasViewportUnits()) |
| 3201 return; |
| 3202 ensureStyleResolver().notifyResizeForViewportUnits(); |
| 3203 setNeedsStyleRecalcForViewportUnits(); |
| 3204 } |
| 3205 |
3198 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd
ateMode updateMode) | 3206 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd
ateMode updateMode) |
3199 { | 3207 { |
3200 // styleResolverChanged() can be invoked during Document destruction. | 3208 // styleResolverChanged() can be invoked during Document destruction. |
3201 // We just skip that case. | 3209 // We just skip that case. |
3202 if (!m_styleEngine) | 3210 if (!m_styleEngine) |
3203 return; | 3211 return; |
3204 | 3212 |
3205 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda
teMode); | 3213 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda
teMode); |
3206 if (change.needsRepaint()) { | 3214 if (change.needsRepaint()) { |
3207 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3215 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5267 } | 5275 } |
5268 | 5276 |
5269 FastTextAutosizer* Document::fastTextAutosizer() | 5277 FastTextAutosizer* Document::fastTextAutosizer() |
5270 { | 5278 { |
5271 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5279 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5272 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5280 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5273 return m_fastTextAutosizer.get(); | 5281 return m_fastTextAutosizer.get(); |
5274 } | 5282 } |
5275 | 5283 |
5276 } // namespace WebCore | 5284 } // namespace WebCore |
OLD | NEW |