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

Side by Side Diff: sky/engine/core/rendering/style/RenderStyle.h

Issue 710113003: Initial step of removing CSS zoom related properties. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rare InheritedData->m_textAlignLast); } 497 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rare InheritedData->m_textAlignLast); }
498 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheri tedData->m_textJustify); } 498 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheri tedData->m_textJustify); }
499 TextDecoration textDecorationsInEffect() const; 499 TextDecoration textDecorationsInEffect() const;
500 const Vector<AppliedTextDecoration>& appliedTextDecorations() const; 500 const Vector<AppliedTextDecoration>& appliedTextDecorations() const;
501 TextDecoration textDecoration() const { return static_cast<TextDecoration>(v isual->textDecoration); } 501 TextDecoration textDecoration() const { return static_cast<TextDecoration>(v isual->textDecoration); }
502 TextUnderlinePosition textUnderlinePosition() const { return static_cast<Tex tUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); } 502 TextUnderlinePosition textUnderlinePosition() const { return static_cast<Tex tUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
503 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDec orationStyle>(rareNonInheritedData->m_textDecorationStyle); } 503 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDec orationStyle>(rareNonInheritedData->m_textDecorationStyle); }
504 float wordSpacing() const; 504 float wordSpacing() const;
505 float letterSpacing() const; 505 float letterSpacing() const;
506 506
507 float zoom() const { return visual->m_zoom; } 507 // FIXME(sky): Remove
508 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } 508 float zoom() const { return 1.0f; }
509 float effectiveZoom() const { return 1.0f; }
509 510
510 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); } 511 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); }
511 bool isLeftToRightDirection() const { return direction() == LTR; } 512 bool isLeftToRightDirection() const { return direction() == LTR; }
512 513
513 const Length& specifiedLineHeight() const; 514 const Length& specifiedLineHeight() const;
514 Length lineHeight() const; 515 Length lineHeight() const;
515 int computedLineHeight() const; 516 int computedLineHeight() const;
516 517
517 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); } 518 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); }
518 static bool autoWrap(EWhiteSpace ws) 519 static bool autoWrap(EWhiteSpace ws)
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; } 965 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
965 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAl ignLast, v); } 966 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAl ignLast, v); }
966 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustif y, v); } 967 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustif y, v); }
967 void applyTextDecorations(); 968 void applyTextDecorations();
968 void clearAppliedTextDecorations(); 969 void clearAppliedTextDecorations();
969 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v ); } 970 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v ); }
970 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInherit edData, m_textUnderlinePosition, v); } 971 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInherit edData, m_textUnderlinePosition, v); }
971 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInherite dData, m_textDecorationStyle, v); } 972 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInherite dData, m_textDecorationStyle, v); }
972 void setDirection(TextDirection v) { inherited_flags._direction = v; } 973 void setDirection(TextDirection v) { inherited_flags._direction = v; }
973 void setLineHeight(const Length& specifiedLineHeight); 974 void setLineHeight(const Length& specifiedLineHeight);
974 bool setZoom(float);
975 bool setEffectiveZoom(float);
976 975
977 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_ima geRendering, v); } 976 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_ima geRendering, v); }
978 977
979 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; } 978 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
980 979
981 // FIXME: Remove these two and replace them with respective FontBuilder call s. 980 // FIXME: Remove these two and replace them with respective FontBuilder call s.
982 void setWordSpacing(float); 981 void setWordSpacing(float);
983 void setLetterSpacing(float); 982 void setLetterSpacing(float);
984 983
985 void adjustBackgroundLayers() 984 void adjustBackgroundLayers()
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 static EVerticalAlign initialVerticalAlign() { return BASELINE; } 1285 static EVerticalAlign initialVerticalAlign() { return BASELINE; }
1287 static short initialWidows() { return 2; } 1286 static short initialWidows() { return 2; }
1288 static short initialOrphans() { return 2; } 1287 static short initialOrphans() { return 2; }
1289 static Length initialLineHeight() { return Length(-100.0, Percent); } 1288 static Length initialLineHeight() { return Length(-100.0, Percent); }
1290 static ETextAlign initialTextAlign() { return TASTART; } 1289 static ETextAlign initialTextAlign() { return TASTART; }
1291 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; } 1290 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1292 static TextJustify initialTextJustify() { return TextJustifyAuto; } 1291 static TextJustify initialTextJustify() { return TextJustifyAuto; }
1293 static TextDecoration initialTextDecoration() { return TextDecorationNone; } 1292 static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1294 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnd erlinePositionAuto; } 1293 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnd erlinePositionAuto; }
1295 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorat ionStyleSolid; } 1294 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorat ionStyleSolid; }
1296 static float initialZoom() { return 1.0f; }
1297 static int initialOutlineOffset() { return 0; } 1295 static int initialOutlineOffset() { return 0; }
1298 static float initialOpacity() { return 1.0f; } 1296 static float initialOpacity() { return 1.0f; }
1299 static EBoxAlignment initialBoxAlign() { return BSTRETCH; } 1297 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1300 static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; } 1298 static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
1301 static EBoxDirection initialBoxDirection() { return BNORMAL; } 1299 static EBoxDirection initialBoxDirection() { return BNORMAL; }
1302 static EBoxLines initialBoxLines() { return SINGLE; } 1300 static EBoxLines initialBoxLines() { return SINGLE; }
1303 static EBoxOrient initialBoxOrient() { return HORIZONTAL; } 1301 static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1304 static EBoxPack initialBoxPack() { return Start; } 1302 static EBoxPack initialBoxPack() { return Start; }
1305 static float initialBoxFlex() { return 0.0f; } 1303 static float initialBoxFlex() { return 0.0f; }
1306 static unsigned initialBoxFlexGroup() { return 1; } 1304 static unsigned initialBoxFlexGroup() { return 1; }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 void addAppliedTextDecoration(const AppliedTextDecoration&); 1435 void addAppliedTextDecoration(const AppliedTextDecoration&);
1438 1436
1439 bool diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& other) const ; 1437 bool diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& other) const ;
1440 bool diffNeedsFullLayout(const RenderStyle& other) const; 1438 bool diffNeedsFullLayout(const RenderStyle& other) const;
1441 bool diffNeedsPaintInvalidationLayer(const RenderStyle& other) const; 1439 bool diffNeedsPaintInvalidationLayer(const RenderStyle& other) const;
1442 bool diffNeedsPaintInvalidationObject(const RenderStyle& other) const; 1440 bool diffNeedsPaintInvalidationObject(const RenderStyle& other) const;
1443 bool diffNeedsRecompositeLayer(const RenderStyle& other) const; 1441 bool diffNeedsRecompositeLayer(const RenderStyle& other) const;
1444 void updatePropertySpecificDifferences(const RenderStyle& other, StyleDiffer ence&) const; 1442 void updatePropertySpecificDifferences(const RenderStyle& other, StyleDiffer ence&) const;
1445 }; 1443 };
1446 1444
1447 // FIXME: Reduce/remove the dependency on zoom adjusted int values.
1448 // The float or LayoutUnit versions of layout values should be used.
1449 inline int adjustForAbsoluteZoom(int value, float zoomFactor)
1450 {
1451 if (zoomFactor == 1)
1452 return value;
1453 // Needed because computeLengthInt truncates (rather than rounds) when scali ng up.
1454 float fvalue = value;
1455 if (zoomFactor > 1) {
1456 if (value < 0)
1457 fvalue -= 0.5f;
1458 else
1459 fvalue += 0.5f;
1460 }
1461
1462 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
1463 }
1464
1465 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1466 {
1467 return adjustForAbsoluteZoom(value, style->effectiveZoom());
1468 }
1469
1470 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style)
1471 {
1472 return value / style.effectiveZoom();
1473 }
1474
1475 inline double adjustDoubleForAbsoluteZoom(double value, const RenderStyle& style )
1476 {
1477 return value / style.effectiveZoom();
1478 }
1479
1480 inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const Render Style& style)
1481 {
1482 return value / style.effectiveZoom();
1483 }
1484
1485 inline bool RenderStyle::setZoom(float f)
1486 {
1487 if (compareEqual(visual->m_zoom, f))
1488 return false;
1489 visual.access()->m_zoom = f;
1490 setEffectiveZoom(effectiveZoom() * zoom());
1491 return true;
1492 }
1493
1494 inline bool RenderStyle::setEffectiveZoom(float f)
1495 {
1496 if (compareEqual(rareInheritedData->m_effectiveZoom, f))
1497 return false;
1498 rareInheritedData.access()->m_effectiveZoom = f;
1499 return true;
1500 }
1501
1502 inline bool RenderStyle::isSharable() const 1445 inline bool RenderStyle::isSharable() const
1503 { 1446 {
1504 return !unique(); 1447 return !unique();
1505 } 1448 }
1506 1449
1507 inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation) 1450 inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
1508 { 1451 {
1509 if (compareEqual(rareInheritedData->m_textOrientation, textOrientation)) 1452 if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
1510 return false; 1453 return false;
1511 1454
1512 rareInheritedData.access()->m_textOrientation = textOrientation; 1455 rareInheritedData.access()->m_textOrientation = textOrientation;
1513 return true; 1456 return true;
1514 } 1457 }
1515 1458
1516 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&); 1459 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&);
1517 1460
1518 } // namespace blink 1461 } // namespace blink
1519 1462
1520 #endif // RenderStyle_h 1463 #endif // RenderStyle_h
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderReplaced.cpp ('k') | sky/engine/core/rendering/style/RenderStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698