Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: Source/core/rendering/style/RenderStyle.h

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RootInlineBox.cpp ('k') | Source/core/rendering/style/RenderStyle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 unsigned _originalDisplay : 5; // EDisplay 236 unsigned _originalDisplay : 5; // EDisplay
237 unsigned _overflowX : 3; // EOverflow 237 unsigned _overflowX : 3; // EOverflow
238 unsigned _overflowY : 3; // EOverflow 238 unsigned _overflowY : 3; // EOverflow
239 unsigned _vertical_align : 4; // EVerticalAlign 239 unsigned _vertical_align : 4; // EVerticalAlign
240 unsigned _clear : 2; // EClear 240 unsigned _clear : 2; // EClear
241 unsigned _position : 3; // EPosition 241 unsigned _position : 3; // EPosition
242 unsigned _floating : 2; // EFloat 242 unsigned _floating : 2; // EFloat
243 unsigned _table_layout : 1; // ETableLayout 243 unsigned _table_layout : 1; // ETableLayout
244 244
245 unsigned _unicodeBidi : 3; // EUnicodeBidi 245 unsigned _unicodeBidi : 3; // EUnicodeBidi
246 // 31 bits 246
247 // This is set if we used viewport units when resolving a length.
248 // It is mutable so we can pass around const RenderStyles to resolve len gths.
249 mutable unsigned hasViewportUnits : 1;
250
251 // 32 bits
252
247 unsigned _page_break_before : 2; // EPageBreak 253 unsigned _page_break_before : 2; // EPageBreak
248 unsigned _page_break_after : 2; // EPageBreak 254 unsigned _page_break_after : 2; // EPageBreak
249 unsigned _page_break_inside : 2; // EPageBreak 255 unsigned _page_break_inside : 2; // EPageBreak
250 256
251 unsigned _styleType : 6; // PseudoId 257 unsigned _styleType : 6; // PseudoId
252 unsigned _pseudoBits : 8; 258 unsigned _pseudoBits : 8;
253 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property 259 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property
254 unsigned currentColor : 1; // At least one color has the value 'currentC olor' 260 unsigned currentColor : 1; // At least one color has the value 'currentC olor'
255 unsigned unique : 1; // Style can not be shared. 261 unsigned unique : 1; // Style can not be shared.
256 unsigned emptyState : 1; 262 unsigned emptyState : 1;
(...skipping 10 matching lines...) Expand all
267 void setAffectedByDrag(bool value) { _affectedByDrag = value; } 273 void setAffectedByDrag(bool value) { _affectedByDrag = value; }
268 bool isLink() const { return _isLink; } 274 bool isLink() const { return _isLink; }
269 void setIsLink(bool value) { _isLink = value; } 275 void setIsLink(bool value) { _isLink = value; }
270 private: 276 private:
271 unsigned _affectedByFocus : 1; 277 unsigned _affectedByFocus : 1;
272 unsigned _affectedByHover : 1; 278 unsigned _affectedByHover : 1;
273 unsigned _affectedByActive : 1; 279 unsigned _affectedByActive : 1;
274 unsigned _affectedByDrag : 1; 280 unsigned _affectedByDrag : 1;
275 unsigned _isLink : 1; 281 unsigned _isLink : 1;
276 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom() 282 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom()
277 // 60 bits 283 // 63 bits
278 } noninherited_flags; 284 } noninherited_flags;
279 285
280 // !END SYNC! 286 // !END SYNC!
281 287
282 protected: 288 protected:
283 void setBitDefaults() 289 void setBitDefaults()
284 { 290 {
285 inherited_flags._empty_cells = initialEmptyCells(); 291 inherited_flags._empty_cells = initialEmptyCells();
286 inherited_flags._caption_side = initialCaptionSide(); 292 inherited_flags._caption_side = initialCaptionSide();
287 inherited_flags._list_style_type = initialListStyleType(); 293 inherited_flags._list_style_type = initialListStyleType();
(...skipping 26 matching lines...) Expand all
314 noninherited_flags._page_break_after = initialPageBreak(); 320 noninherited_flags._page_break_after = initialPageBreak();
315 noninherited_flags._page_break_inside = initialPageBreak(); 321 noninherited_flags._page_break_inside = initialPageBreak();
316 noninherited_flags._styleType = NOPSEUDO; 322 noninherited_flags._styleType = NOPSEUDO;
317 noninherited_flags._pseudoBits = 0; 323 noninherited_flags._pseudoBits = 0;
318 noninherited_flags.explicitInheritance = false; 324 noninherited_flags.explicitInheritance = false;
319 noninherited_flags.currentColor = false; 325 noninherited_flags.currentColor = false;
320 noninherited_flags.unique = false; 326 noninherited_flags.unique = false;
321 noninherited_flags.emptyState = false; 327 noninherited_flags.emptyState = false;
322 noninherited_flags.firstChildState = false; 328 noninherited_flags.firstChildState = false;
323 noninherited_flags.lastChildState = false; 329 noninherited_flags.lastChildState = false;
330 noninherited_flags.hasViewportUnits = false;
324 noninherited_flags.setAffectedByFocus(false); 331 noninherited_flags.setAffectedByFocus(false);
325 noninherited_flags.setAffectedByHover(false); 332 noninherited_flags.setAffectedByHover(false);
326 noninherited_flags.setAffectedByActive(false); 333 noninherited_flags.setAffectedByActive(false);
327 noninherited_flags.setAffectedByDrag(false); 334 noninherited_flags.setAffectedByDrag(false);
328 noninherited_flags.setIsLink(false); 335 noninherited_flags.setIsLink(false);
329 } 336 }
330 337
331 private: 338 private:
332 ALWAYS_INLINE RenderStyle(); 339 ALWAYS_INLINE RenderStyle();
333 340
(...skipping 21 matching lines...) Expand all
355 362
356 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags ._styleType); } 363 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags ._styleType); }
357 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styl eType; } 364 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styl eType; }
358 365
359 RenderStyle* getCachedPseudoStyle(PseudoId) const; 366 RenderStyle* getCachedPseudoStyle(PseudoId) const;
360 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>); 367 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
361 void removeCachedPseudoStyle(PseudoId); 368 void removeCachedPseudoStyle(PseudoId);
362 369
363 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); } 370 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); }
364 371
372 void setHasViewportUnits(bool hasViewportUnits = true) const { noninherited_ flags.hasViewportUnits = hasViewportUnits; }
373 bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits; }
374
365 void setVariable(const AtomicString& name, const String& value) { rareInheri tedData.access()->m_variables.access()->setVariable(name, value); } 375 void setVariable(const AtomicString& name, const String& value) { rareInheri tedData.access()->m_variables.access()->setVariable(name, value); }
366 const HashMap<AtomicString, String>* variables() { return &(rareInheritedDat a->m_variables->m_data); } 376 const HashMap<AtomicString, String>* variables() { return &(rareInheritedDat a->m_variables->m_data); }
367 377
368 bool affectedByFocus() const { return noninherited_flags.affectedByFocus(); } 378 bool affectedByFocus() const { return noninherited_flags.affectedByFocus(); }
369 bool affectedByHover() const { return noninherited_flags.affectedByHover(); } 379 bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
370 bool affectedByActive() const { return noninherited_flags.affectedByActive() ; } 380 bool affectedByActive() const { return noninherited_flags.affectedByActive() ; }
371 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); } 381 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); }
372 382
373 void setAffectedByFocus() { noninherited_flags.setAffectedByFocus(true); } 383 void setAffectedByFocus() { noninherited_flags.setAffectedByFocus(true); }
374 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); } 384 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 float letterSpacing() const; 575 float letterSpacing() const;
566 576
567 float zoom() const { return visual->m_zoom; } 577 float zoom() const { return visual->m_zoom; }
568 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } 578 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
569 579
570 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); } 580 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); }
571 bool isLeftToRightDirection() const { return direction() == LTR; } 581 bool isLeftToRightDirection() const { return direction() == LTR; }
572 582
573 Length specifiedLineHeight() const; 583 Length specifiedLineHeight() const;
574 Length lineHeight() const; 584 Length lineHeight() const;
575 int computedLineHeight(RenderView* = 0) const; 585 int computedLineHeight() const;
576 586
577 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); } 587 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); }
578 static bool autoWrap(EWhiteSpace ws) 588 static bool autoWrap(EWhiteSpace ws)
579 { 589 {
580 // Nowrap and pre don't automatically wrap. 590 // Nowrap and pre don't automatically wrap.
581 return ws != NOWRAP && ws != PRE; 591 return ws != NOWRAP && ws != PRE;
582 } 592 }
583 593
584 bool autoWrap() const 594 bool autoWrap() const
585 { 595 {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 setBorderTopLeftRadius(s); 1022 setBorderTopLeftRadius(s);
1013 setBorderTopRightRadius(s); 1023 setBorderTopRightRadius(s);
1014 setBorderBottomLeftRadius(s); 1024 setBorderBottomLeftRadius(s);
1015 setBorderBottomRightRadius(s); 1025 setBorderBottomRightRadius(s);
1016 } 1026 }
1017 void setBorderRadius(const IntSize& s) 1027 void setBorderRadius(const IntSize& s)
1018 { 1028 {
1019 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); 1029 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1020 } 1030 }
1021 1031
1022 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) cons t; 1032 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLo gicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1023 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 1033 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1024 1034
1025 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, 1035 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1026 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool inclu deLogicalLeftEdge, bool includeLogicalRightEdge) const; 1036 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool inclu deLogicalLeftEdge, bool includeLogicalRightEdge) const;
1027 1037
1028 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_widt h, v); } 1038 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_widt h, v); }
1029 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); } 1039 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); }
1030 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, bo rder.m_left, v); } 1040 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, bo rder.m_left, v); }
1031 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_wi dth, v); } 1041 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_wi dth, v); }
1032 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); } 1042 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); }
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo) 1869 inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
1860 { 1870 {
1861 ASSERT(pseudo > NOPSEUDO); 1871 ASSERT(pseudo > NOPSEUDO);
1862 ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID); 1872 ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
1863 noninherited_flags._pseudoBits |= 1 << (pseudo - 1); 1873 noninherited_flags._pseudoBits |= 1 << (pseudo - 1);
1864 } 1874 }
1865 1875
1866 } // namespace WebCore 1876 } // namespace WebCore
1867 1877
1868 #endif // RenderStyle_h 1878 #endif // RenderStyle_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RootInlineBox.cpp ('k') | Source/core/rendering/style/RenderStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698