Chromium Code Reviews| 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 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1889 } | 1889 } |
| 1890 | 1890 |
| 1891 bool Document::isPageBoxVisible(int pageIndex) | 1891 bool Document::isPageBoxVisible(int pageIndex) |
| 1892 { | 1892 { |
| 1893 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page. | 1893 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page. |
| 1894 } | 1894 } |
| 1895 | 1895 |
| 1896 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1896 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
| 1897 { | 1897 { |
| 1898 RefPtr<RenderStyle> style = styleForPage(pageIndex); | 1898 RefPtr<RenderStyle> style = styleForPage(pageIndex); |
| 1899 RenderView* view = renderView(); | |
| 1900 | 1899 |
| 1901 int width = pageSize.width(); | 1900 int width = pageSize.width(); |
| 1902 int height = pageSize.height(); | 1901 int height = pageSize.height(); |
| 1903 switch (style->pageSizeType()) { | 1902 switch (style->pageSizeType()) { |
| 1904 case PAGE_SIZE_AUTO: | 1903 case PAGE_SIZE_AUTO: |
| 1905 break; | 1904 break; |
| 1906 case PAGE_SIZE_AUTO_LANDSCAPE: | 1905 case PAGE_SIZE_AUTO_LANDSCAPE: |
| 1907 if (width < height) | 1906 if (width < height) |
| 1908 std::swap(width, height); | 1907 std::swap(width, height); |
| 1909 break; | 1908 break; |
| 1910 case PAGE_SIZE_AUTO_PORTRAIT: | 1909 case PAGE_SIZE_AUTO_PORTRAIT: |
| 1911 if (width > height) | 1910 if (width > height) |
| 1912 std::swap(width, height); | 1911 std::swap(width, height); |
| 1913 break; | 1912 break; |
| 1914 case PAGE_SIZE_RESOLVED: { | 1913 case PAGE_SIZE_RESOLVED: { |
| 1915 LengthSize size = style->pageSize(); | 1914 LengthSize size = style->pageSize(); |
| 1916 ASSERT(size.width().isFixed()); | 1915 ASSERT(size.width().isFixed()); |
| 1917 ASSERT(size.height().isFixed()); | 1916 ASSERT(size.height().isFixed()); |
| 1918 width = valueForLength(size.width(), 0, view); | 1917 width = valueForLength(size.width(), 0); |
| 1919 height = valueForLength(size.height(), 0, view); | 1918 height = valueForLength(size.height(), 0); |
| 1920 break; | 1919 break; |
| 1921 } | 1920 } |
| 1922 default: | 1921 default: |
| 1923 ASSERT_NOT_REACHED(); | 1922 ASSERT_NOT_REACHED(); |
| 1924 } | 1923 } |
| 1925 pageSize = IntSize(width, height); | 1924 pageSize = IntSize(width, height); |
| 1926 | 1925 |
| 1927 // The percentage is calculated with respect to the width even for margin to p and bottom. | 1926 // The percentage is calculated with respect to the width even for margin to p and bottom. |
| 1928 // http://www.w3.org/TR/CSS2/box.html#margin-properties | 1927 // http://www.w3.org/TR/CSS2/box.html#margin-properties |
| 1929 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl e->marginTop(), width, view); | 1928 marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(styl e->marginTop(), width); |
| 1930 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt h(style->marginRight(), width, view); | 1929 marginRight = style->marginRight().isAuto() ? marginRight : intValueForLengt h(style->marginRight(), width); |
| 1931 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe ngth(style->marginBottom(), width, view); | 1930 marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLe ngth(style->marginBottom(), width); |
| 1932 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s tyle->marginLeft(), width, view); | 1931 marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(s tyle->marginLeft(), width); |
| 1933 } | 1932 } |
| 1934 | 1933 |
| 1935 void Document::setIsViewSource(bool isViewSource) | 1934 void Document::setIsViewSource(bool isViewSource) |
| 1936 { | 1935 { |
| 1937 m_isViewSource = isViewSource; | 1936 m_isViewSource = isViewSource; |
| 1938 if (!m_isViewSource) | 1937 if (!m_isViewSource) |
| 1939 return; | 1938 return; |
| 1940 | 1939 |
| 1941 setSecurityOrigin(SecurityOrigin::createUnique()); | 1940 setSecurityOrigin(SecurityOrigin::createUnique()); |
| 1942 didUpdateSecurityOrigin(); | 1941 didUpdateSecurityOrigin(); |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3163 m_styleEngine->setSelectedStylesheetSetName(aString); | 3162 m_styleEngine->setSelectedStylesheetSetName(aString); |
| 3164 styleResolverChanged(RecalcStyleDeferred); | 3163 styleResolverChanged(RecalcStyleDeferred); |
| 3165 } | 3164 } |
| 3166 | 3165 |
| 3167 void Document::evaluateMediaQueryList() | 3166 void Document::evaluateMediaQueryList() |
| 3168 { | 3167 { |
| 3169 if (m_mediaQueryMatcher) | 3168 if (m_mediaQueryMatcher) |
| 3170 m_mediaQueryMatcher->styleResolverChanged(); | 3169 m_mediaQueryMatcher->styleResolverChanged(); |
| 3171 } | 3170 } |
| 3172 | 3171 |
| 3172 void Document::notifyResizeForViewportUnits() | |
| 3173 { | |
| 3174 if (!hasViewportUnits()) | |
| 3175 return; | |
| 3176 if (StyleResolver* styleResolver = styleResolverIfExists()) | |
| 3177 styleResolver->invalidateViewportDependentMatchedProperties(); | |
| 3178 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme nt = ElementTraversal::next(*element)) { | |
| 3179 RenderStyle* style = element->renderStyle(); | |
| 3180 if (style && style->hasViewportUnits()) | |
| 3181 element->setNeedsStyleRecalc(LocalStyleChange); | |
|
rune
2013/12/04 08:27:17
Does LocalStyleChange work for explicit or implici
| |
| 3182 } | |
| 3183 } | |
| 3184 | |
| 3173 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd ateMode updateMode) | 3185 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd ateMode updateMode) |
| 3174 { | 3186 { |
| 3175 // styleResolverChanged() can be invoked during Document destruction. | 3187 // styleResolverChanged() can be invoked during Document destruction. |
| 3176 // We just skip that case. | 3188 // We just skip that case. |
| 3177 if (!m_styleEngine) | 3189 if (!m_styleEngine) |
| 3178 return; | 3190 return; |
| 3179 | 3191 |
| 3180 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda teMode); | 3192 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda teMode); |
| 3181 if (change.needsRepaint()) { | 3193 if (change.needsRepaint()) { |
| 3182 // We need to manually repaint because we avoid doing all repaints in la yout or style | 3194 // We need to manually repaint because we avoid doing all repaints in la yout or style |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5234 } | 5246 } |
| 5235 | 5247 |
| 5236 FastTextAutosizer* Document::fastTextAutosizer() | 5248 FastTextAutosizer* Document::fastTextAutosizer() |
| 5237 { | 5249 { |
| 5238 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) | 5250 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) |
| 5239 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5251 m_fastTextAutosizer = FastTextAutosizer::create(this); |
| 5240 return m_fastTextAutosizer.get(); | 5252 return m_fastTextAutosizer.get(); |
| 5241 } | 5253 } |
| 5242 | 5254 |
| 5243 } // namespace WebCore | 5255 } // namespace WebCore |
| OLD | NEW |