| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 case CSSPropertyWebkitTextFillColor: | 97 case CSSPropertyWebkitTextFillColor: |
| 98 case CSSPropertyWebkitTextStrokeColor: | 98 case CSSPropertyWebkitTextStrokeColor: |
| 99 return true; | 99 return true; |
| 100 default: | 100 default: |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
SValue* value) | 107 void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
SValue value) |
| 108 { | 108 { |
| 109 ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wa
sn't expanded at parsing time", id); | 109 ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wa
sn't expanded at parsing time", id); |
| 110 | 110 |
| 111 bool isInherit = state.parentNode() && value->isInheritedValue(); | 111 bool isInherit = state.parentNode() && value.isInheritedValue(); |
| 112 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i
sInheritedValue()); | 112 bool isInitial = value.isInitialValue() || (!state.parentNode() && value.isI
nheritedValue()); |
| 113 | 113 |
| 114 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial ->
!isInherit | 114 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial ->
!isInherit |
| 115 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe
rit -> (state.parentNode() && state.parentStyle()) | 115 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe
rit -> (state.parentNode() && state.parentStyle()) |
| 116 | 116 |
| 117 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi
nkStyle() || !isValidVisitedLinkProperty(id))) { | 117 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi
nkStyle() || !isValidVisitedLinkProperty(id))) { |
| 118 // Limit the properties that can be applied to only the ones honored by
:visited. | 118 // Limit the properties that can be applied to only the ones honored by
:visited. |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() &&
!CSSPropertyMetadata::isInheritedProperty(id)) { | 122 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() &&
!CSSPropertyMetadata::isInheritedProperty(id)) { |
| 123 state.parentStyle()->setHasExplicitlyInheritedProperties(); | 123 state.parentStyle()->setHasExplicitlyInheritedProperties(); |
| 124 } else if (value->isUnsetValue()) { | 124 } else if (value.isUnsetValue()) { |
| 125 ASSERT(!isInherit && !isInitial); | 125 ASSERT(!isInherit && !isInitial); |
| 126 if (CSSPropertyMetadata::isInheritedProperty(id)) | 126 if (CSSPropertyMetadata::isInheritedProperty(id)) |
| 127 isInherit = true; | 127 isInherit = true; |
| 128 else | 128 else |
| 129 isInitial = true; | 129 isInitial = true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 StyleBuilder::applyProperty(id, state, value, isInitial, isInherit); | 132 StyleBuilder::applyProperty(id, state, value, isInitial, isInherit); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void StyleBuilderFunctions::applyInitialCSSPropertyColor(StyleResolverState& sta
te) | 135 void StyleBuilderFunctions::applyInitialCSSPropertyColor(StyleResolverState& sta
te) |
| 136 { | 136 { |
| 137 Color color = ComputedStyle::initialColor(); | 137 Color color = ComputedStyle::initialColor(); |
| 138 if (state.applyPropertyToRegularStyle()) | 138 if (state.applyPropertyToRegularStyle()) |
| 139 state.style()->setColor(color); | 139 state.style()->setColor(color); |
| 140 if (state.applyPropertyToVisitedLinkStyle()) | 140 if (state.applyPropertyToVisitedLinkStyle()) |
| 141 state.style()->setVisitedLinkColor(color); | 141 state.style()->setVisitedLinkColor(color); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void StyleBuilderFunctions::applyInheritCSSPropertyColor(StyleResolverState& sta
te) | 144 void StyleBuilderFunctions::applyInheritCSSPropertyColor(StyleResolverState& sta
te) |
| 145 { | 145 { |
| 146 Color color = state.parentStyle()->color(); | 146 Color color = state.parentStyle()->color(); |
| 147 if (state.applyPropertyToRegularStyle()) | 147 if (state.applyPropertyToRegularStyle()) |
| 148 state.style()->setColor(color); | 148 state.style()->setColor(color); |
| 149 if (state.applyPropertyToVisitedLinkStyle()) | 149 if (state.applyPropertyToVisitedLinkStyle()) |
| 150 state.style()->setVisitedLinkColor(color); | 150 state.style()->setVisitedLinkColor(color); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, CSSValue* value) | 153 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, CSSValue value) |
| 154 { | 154 { |
| 155 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 155 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 156 // As per the spec, 'color: currentColor' is treated as 'color: inherit' | 156 // As per the spec, 'color: currentColor' is treated as 'color: inherit' |
| 157 if (primitiveValue->getValueID() == CSSValueCurrentcolor) { | 157 if (primitiveValue.getValueID() == CSSValueCurrentcolor) { |
| 158 applyInheritCSSPropertyColor(state); | 158 applyInheritCSSPropertyColor(state); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (state.applyPropertyToRegularStyle()) | 162 if (state.applyPropertyToRegularStyle()) |
| 163 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); | 163 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); |
| 164 if (state.applyPropertyToVisitedLinkStyle()) | 164 if (state.applyPropertyToVisitedLinkStyle()) |
| 165 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); | 165 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st
ate) | 168 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st
ate) |
| 169 { | 169 { |
| 170 state.style()->clearCursorList(); | 170 state.style()->clearCursorList(); |
| 171 state.style()->setCursor(ComputedStyle::initialCursor()); | 171 state.style()->setCursor(ComputedStyle::initialCursor()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st
ate) | 174 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st
ate) |
| 175 { | 175 { |
| 176 state.style()->setCursor(state.parentStyle()->cursor()); | 176 state.style()->setCursor(state.parentStyle()->cursor()); |
| 177 state.style()->setCursorList(state.parentStyle()->cursors()); | 177 state.style()->setCursorList(state.parentStyle()->cursors()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& stat
e, CSSValue* value) | 180 void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& stat
e, CSSValue value) |
| 181 { | 181 { |
| 182 state.style()->clearCursorList(); | 182 state.style()->clearCursorList(); |
| 183 if (value->isValueList()) { | 183 if (value.isValueList()) { |
| 184 CSSValueList* list = toCSSValueList(value); | 184 CSSValueList& list = toCSSValueList(value); |
| 185 int len = list->length(); | 185 int len = list.length(); |
| 186 state.style()->setCursor(CURSOR_AUTO); | 186 state.style()->setCursor(CURSOR_AUTO); |
| 187 for (int i = 0; i < len; i++) { | 187 for (int i = 0; i < len; i++) { |
| 188 CSSValue* item = list->item(i); | 188 CSSValue item = list.item(i); |
| 189 if (item->isCursorImageValue()) { | 189 if (item.isCursorImageValue()) { |
| 190 CSSCursorImageValue* image = toCSSCursorImageValue(item); | 190 CSSCursorImageValue& image = toCSSCursorImageValue(item); |
| 191 if (image->updateIfSVGCursorIsUsed(state.element())) // Elements
with SVG cursors are not allowed to share style. | 191 if (image.updateIfSVGCursorIsUsed(state.element())) // Elements
with SVG cursors are not allowed to share style. |
| 192 state.style()->setUnique(); | 192 state.style()->setUnique(); |
| 193 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ima
ge), image->hotSpotSpecified(), image->hotSpot()); | 193 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ite
m), image.hotSpotSpecified(), image.hotSpot()); |
| 194 } else { | 194 } else { |
| 195 state.style()->setCursor(*toCSSPrimitiveValue(item)); | 195 state.style()->setCursor(toCSSPrimitiveValue(item)); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } else { | 198 } else { |
| 199 state.style()->setCursor(*toCSSPrimitiveValue(value)); | 199 state.style()->setCursor(toCSSPrimitiveValue(value)); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, CSSValue* value) | 203 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, CSSValue value) |
| 204 { | 204 { |
| 205 state.style()->setDirection(*toCSSPrimitiveValue(value)); | 205 state.style()->setDirection(toCSSPrimitiveValue(value)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void StyleBuilderFunctions::applyValueCSSPropertyGlyphOrientationVertical(StyleR
esolverState& state, CSSValue* value) | 208 void StyleBuilderFunctions::applyValueCSSPropertyGlyphOrientationVertical(StyleR
esolverState& state, CSSValue value) |
| 209 { | 209 { |
| 210 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() ==
CSSValueAuto) | 210 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C
SSValueAuto) |
| 211 state.style()->accessSVGStyle().setGlyphOrientationVertical(GO_AUTO); | 211 state.style()->accessSVGStyle().setGlyphOrientationVertical(GO_AUTO); |
| 212 else | 212 else |
| 213 state.style()->accessSVGStyle().setGlyphOrientationVertical(StyleBuilder
Converter::convertGlyphOrientation(state, value)); | 213 state.style()->accessSVGStyle().setGlyphOrientationVertical(StyleBuilder
Converter::convertGlyphOrientation(state, value)); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void StyleBuilderFunctions::applyInitialCSSPropertyGridTemplateAreas(StyleResolv
erState& state) | 216 void StyleBuilderFunctions::applyInitialCSSPropertyGridTemplateAreas(StyleResolv
erState& state) |
| 217 { | 217 { |
| 218 state.style()->setNamedGridArea(ComputedStyle::initialNamedGridArea()); | 218 state.style()->setNamedGridArea(ComputedStyle::initialNamedGridArea()); |
| 219 state.style()->setNamedGridAreaRowCount(ComputedStyle::initialNamedGridAreaC
ount()); | 219 state.style()->setNamedGridAreaRowCount(ComputedStyle::initialNamedGridAreaC
ount()); |
| 220 state.style()->setNamedGridAreaColumnCount(ComputedStyle::initialNamedGridAr
eaCount()); | 220 state.style()->setNamedGridAreaColumnCount(ComputedStyle::initialNamedGridAr
eaCount()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv
erState& state) | 223 void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv
erState& state) |
| 224 { | 224 { |
| 225 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea()); | 225 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea()); |
| 226 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRo
wCount()); | 226 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRo
wCount()); |
| 227 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAre
aColumnCount()); | 227 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAre
aColumnCount()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver
State& state, CSSValue* value) | 230 void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver
State& state, CSSValue value) |
| 231 { | 231 { |
| 232 if (value->isPrimitiveValue()) { | 232 if (value.isPrimitiveValue()) { |
| 233 // FIXME: Shouldn't we clear the grid-area values | 233 // FIXME: Shouldn't we clear the grid-area values |
| 234 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); | 234 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 | 237 |
| 238 CSSGridTemplateAreasValue* gridTemplateAreasValue = toCSSGridTemplateAreasVa
lue(value); | 238 CSSGridTemplateAreasValue& gridTemplateAreasValue = toCSSGridTemplateAreasVa
lue(value); |
| 239 const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue->gridArea
Map(); | 239 const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue.gridAreaM
ap(); |
| 240 | 240 |
| 241 NamedGridLinesMap namedGridColumnLines; | 241 NamedGridLinesMap namedGridColumnLines; |
| 242 NamedGridLinesMap namedGridRowLines; | 242 NamedGridLinesMap namedGridRowLines; |
| 243 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridColumnLines(), namedGridColumnLines); | 243 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridColumnLines(), namedGridColumnLines); |
| 244 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridRowLines(), namedGridRowLines); | 244 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridRowLines(), namedGridRowLines); |
| 245 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid
Areas, namedGridColumnLines, ForColumns); | 245 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid
Areas, namedGridColumnLines, ForColumns); |
| 246 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid
Areas, namedGridRowLines, ForRows); | 246 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid
Areas, namedGridRowLines, ForRows); |
| 247 state.style()->setNamedGridColumnLines(namedGridColumnLines); | 247 state.style()->setNamedGridColumnLines(namedGridColumnLines); |
| 248 state.style()->setNamedGridRowLines(namedGridRowLines); | 248 state.style()->setNamedGridRowLines(namedGridRowLines); |
| 249 | 249 |
| 250 state.style()->setNamedGridArea(newNamedGridAreas); | 250 state.style()->setNamedGridArea(newNamedGridAreas); |
| 251 state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue->rowCount()); | 251 state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue.rowCount()); |
| 252 state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue->columnCou
nt()); | 252 state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue.columnCoun
t()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverSta
te& state, CSSValue* value) | 255 void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverSta
te& state, CSSValue value) |
| 256 { | 256 { |
| 257 state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage,
value)); | 257 state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage,
value)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void StyleBuilderFunctions::applyInitialCSSPropertyOutlineStyle(StyleResolverSta
te& state) | 260 void StyleBuilderFunctions::applyInitialCSSPropertyOutlineStyle(StyleResolverSta
te& state) |
| 261 { | 261 { |
| 262 state.style()->setOutlineStyleIsAuto(ComputedStyle::initialOutlineStyleIsAut
o()); | 262 state.style()->setOutlineStyleIsAuto(ComputedStyle::initialOutlineStyleIsAut
o()); |
| 263 state.style()->setOutlineStyle(ComputedStyle::initialBorderStyle()); | 263 state.style()->setOutlineStyle(ComputedStyle::initialBorderStyle()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) | 266 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) |
| 267 { | 267 { |
| 268 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); | 268 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); |
| 269 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); | 269 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, CSSValue* value) | 272 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, CSSValue value) |
| 273 { | 273 { |
| 274 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 274 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 275 state.style()->setOutlineStyleIsAuto(*primitiveValue); | 275 state.style()->setOutlineStyleIsAuto(primitiveValue); |
| 276 state.style()->setOutlineStyle(*primitiveValue); | 276 state.style()->setOutlineStyle(primitiveValue); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, CSSValue* value) | 279 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, CSSValue value) |
| 280 { | 280 { |
| 281 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 281 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 282 | 282 |
| 283 EResize r = RESIZE_NONE; | 283 EResize r = RESIZE_NONE; |
| 284 if (primitiveValue->getValueID() == CSSValueAuto) { | 284 if (primitiveValue.getValueID() == CSSValueAuto) { |
| 285 if (Settings* settings = state.document().settings()) | 285 if (Settings* settings = state.document().settings()) |
| 286 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; | 286 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; |
| 287 } else { | 287 } else { |
| 288 r = *primitiveValue; | 288 r = primitiveValue; |
| 289 } | 289 } |
| 290 state.style()->setResize(r); | 290 state.style()->setResize(r); |
| 291 } | 291 } |
| 292 | 292 |
| 293 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } | 293 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } |
| 294 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } | 294 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } |
| 295 static FloatSize getPageSizeFromName(CSSPrimitiveValue* pageSizeName) | 295 static FloatSize getPageSizeFromName(CSSPrimitiveValue& pageSizeName) |
| 296 { | 296 { |
| 297 switch (pageSizeName->getValueID()) { | 297 switch (pageSizeName.getValueID()) { |
| 298 case CSSValueA5: | 298 case CSSValueA5: |
| 299 return FloatSize(mmToPx(148), mmToPx(210)); | 299 return FloatSize(mmToPx(148), mmToPx(210)); |
| 300 case CSSValueA4: | 300 case CSSValueA4: |
| 301 return FloatSize(mmToPx(210), mmToPx(297)); | 301 return FloatSize(mmToPx(210), mmToPx(297)); |
| 302 case CSSValueA3: | 302 case CSSValueA3: |
| 303 return FloatSize(mmToPx(297), mmToPx(420)); | 303 return FloatSize(mmToPx(297), mmToPx(420)); |
| 304 case CSSValueB5: | 304 case CSSValueB5: |
| 305 return FloatSize(mmToPx(176), mmToPx(250)); | 305 return FloatSize(mmToPx(176), mmToPx(250)); |
| 306 case CSSValueB4: | 306 case CSSValueB4: |
| 307 return FloatSize(mmToPx(250), mmToPx(353)); | 307 return FloatSize(mmToPx(250), mmToPx(353)); |
| 308 case CSSValueLetter: | 308 case CSSValueLetter: |
| 309 return FloatSize(inchToPx(8.5), inchToPx(11)); | 309 return FloatSize(inchToPx(8.5), inchToPx(11)); |
| 310 case CSSValueLegal: | 310 case CSSValueLegal: |
| 311 return FloatSize(inchToPx(8.5), inchToPx(14)); | 311 return FloatSize(inchToPx(8.5), inchToPx(14)); |
| 312 case CSSValueLedger: | 312 case CSSValueLedger: |
| 313 return FloatSize(inchToPx(11), inchToPx(17)); | 313 return FloatSize(inchToPx(11), inchToPx(17)); |
| 314 default: | 314 default: |
| 315 ASSERT_NOT_REACHED(); | 315 ASSERT_NOT_REACHED(); |
| 316 return FloatSize(0, 0); | 316 return FloatSize(0, 0); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } | 320 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } |
| 321 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } | 321 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } |
| 322 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
CSSValue* value) | 322 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
CSSValue value) |
| 323 { | 323 { |
| 324 state.style()->resetPageSizeType(); | 324 state.style()->resetPageSizeType(); |
| 325 FloatSize size; | 325 FloatSize size; |
| 326 PageSizeType pageSizeType = PAGE_SIZE_AUTO; | 326 PageSizeType pageSizeType = PAGE_SIZE_AUTO; |
| 327 CSSValueList* list = toCSSValueList(value); | 327 CSSValueList& list = toCSSValueList(value); |
| 328 if (list->length() == 2) { | 328 if (list.length() == 2) { |
| 329 // <length>{2} | <page-size> <orientation> | 329 // <length>{2} | <page-size> <orientation> |
| 330 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0)); | 330 CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); |
| 331 CSSPrimitiveValue* second = toCSSPrimitiveValue(list->item(1)); | 331 CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); |
| 332 if (first->isLength()) { | 332 if (first.isLength()) { |
| 333 // <length>{2} | 333 // <length>{2} |
| 334 size = FloatSize(first->computeLength<float>(state.cssToLengthConver
sionData().copyWithAdjustedZoom(1.0)), | 334 size = FloatSize(first.computeLength<float>(state.cssToLengthConvers
ionData().copyWithAdjustedZoom(1.0)), |
| 335 second->computeLength<float>(state.cssToLengthConversionData().c
opyWithAdjustedZoom(1.0))); | 335 second.computeLength<float>(state.cssToLengthConversionData().co
pyWithAdjustedZoom(1.0))); |
| 336 } else { | 336 } else { |
| 337 // <page-size> <orientation> | 337 // <page-size> <orientation> |
| 338 size = getPageSizeFromName(first); | 338 size = getPageSizeFromName(first); |
| 339 | 339 |
| 340 ASSERT(second->getValueID() == CSSValueLandscape || second->getValue
ID() == CSSValuePortrait); | 340 ASSERT(second.getValueID() == CSSValueLandscape || second.getValueID
() == CSSValuePortrait); |
| 341 if (second->getValueID() == CSSValueLandscape) | 341 if (second.getValueID() == CSSValueLandscape) |
| 342 size = size.transposedSize(); | 342 size = size.transposedSize(); |
| 343 } | 343 } |
| 344 pageSizeType = PAGE_SIZE_RESOLVED; | 344 pageSizeType = PAGE_SIZE_RESOLVED; |
| 345 } else { | 345 } else { |
| 346 ASSERT(list->length() == 1); | 346 ASSERT(list.length() == 1); |
| 347 // <length> | auto | <page-size> | [ portrait | landscape] | 347 // <length> | auto | <page-size> | [ portrait | landscape] |
| 348 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0)); | 348 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0)); |
| 349 if (primitiveValue->isLength()) { | 349 if (primitiveValue.isLength()) { |
| 350 // <length> | 350 // <length> |
| 351 pageSizeType = PAGE_SIZE_RESOLVED; | 351 pageSizeType = PAGE_SIZE_RESOLVED; |
| 352 float width = primitiveValue->computeLength<float>(state.cssToLength
ConversionData().copyWithAdjustedZoom(1.0)); | 352 float width = primitiveValue.computeLength<float>(state.cssToLengthC
onversionData().copyWithAdjustedZoom(1.0)); |
| 353 size = FloatSize(width, width); | 353 size = FloatSize(width, width); |
| 354 } else { | 354 } else { |
| 355 switch (primitiveValue->getValueID()) { | 355 switch (primitiveValue.getValueID()) { |
| 356 case CSSValueAuto: | 356 case CSSValueAuto: |
| 357 pageSizeType = PAGE_SIZE_AUTO; | 357 pageSizeType = PAGE_SIZE_AUTO; |
| 358 break; | 358 break; |
| 359 case CSSValuePortrait: | 359 case CSSValuePortrait: |
| 360 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; | 360 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; |
| 361 break; | 361 break; |
| 362 case CSSValueLandscape: | 362 case CSSValueLandscape: |
| 363 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; | 363 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; |
| 364 break; | 364 break; |
| 365 default: | 365 default: |
| 366 // <page-size> | 366 // <page-size> |
| 367 pageSizeType = PAGE_SIZE_RESOLVED; | 367 pageSizeType = PAGE_SIZE_RESOLVED; |
| 368 size = getPageSizeFromName(primitiveValue); | 368 size = getPageSizeFromName(primitiveValue); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 state.style()->setPageSizeType(pageSizeType); | 372 state.style()->setPageSizeType(pageSizeType); |
| 373 state.style()->setPageSize(size); | 373 state.style()->setPageSize(size); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, CSSValue* value) | 376 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, CSSValue value) |
| 377 { | 377 { |
| 378 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 378 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 379 if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueW
ebkitMatchParent) | 379 if (primitiveValue.isValueID() && primitiveValue.getValueID() != CSSValueWeb
kitMatchParent) |
| 380 state.style()->setTextAlign(*primitiveValue); | 380 state.style()->setTextAlign(primitiveValue); |
| 381 else if (state.parentStyle()->textAlign() == TASTART) | 381 else if (state.parentStyle()->textAlign() == TASTART) |
| 382 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); | 382 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); |
| 383 else if (state.parentStyle()->textAlign() == TAEND) | 383 else if (state.parentStyle()->textAlign() == TAEND) |
| 384 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); | 384 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); |
| 385 else | 385 else |
| 386 state.style()->setTextAlign(state.parentStyle()->textAlign()); | 386 state.style()->setTextAlign(state.parentStyle()->textAlign()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) | 389 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) |
| 390 { | 390 { |
| 391 state.style()->setTextIndent(state.parentStyle()->textIndent()); | 391 state.style()->setTextIndent(state.parentStyle()->textIndent()); |
| 392 state.style()->setTextIndentLine(state.parentStyle()->textIndentLine()); | 392 state.style()->setTextIndentLine(state.parentStyle()->textIndentLine()); |
| 393 state.style()->setTextIndentType(state.parentStyle()->textIndentType()); | 393 state.style()->setTextIndentType(state.parentStyle()->textIndentType()); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState
& state) | 396 void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState
& state) |
| 397 { | 397 { |
| 398 state.style()->setTextIndent(ComputedStyle::initialTextIndent()); | 398 state.style()->setTextIndent(ComputedStyle::initialTextIndent()); |
| 399 state.style()->setTextIndentLine(ComputedStyle::initialTextIndentLine()); | 399 state.style()->setTextIndentLine(ComputedStyle::initialTextIndentLine()); |
| 400 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); | 400 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, CSSValue* value) | 403 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, CSSValue value) |
| 404 { | 404 { |
| 405 Length lengthOrPercentageValue; | 405 Length lengthOrPercentageValue; |
| 406 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); | 406 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); |
| 407 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); | 407 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); |
| 408 | 408 |
| 409 for (auto& listValue : toCSSValueList(*value)) { | 409 for (auto& listValue : toCSSValueList(value)) { |
| 410 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(listValue.get())
; | 410 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(listValue); |
| 411 if (!primitiveValue->getValueID()) | 411 if (!primitiveValue.getValueID()) |
| 412 lengthOrPercentageValue = primitiveValue->convertToLength(state.cssT
oLengthConversionData()); | 412 lengthOrPercentageValue = primitiveValue.convertToLength(state.cssTo
LengthConversionData()); |
| 413 else if (primitiveValue->getValueID() == CSSValueEachLine) | 413 else if (primitiveValue.getValueID() == CSSValueEachLine) |
| 414 textIndentLineValue = TextIndentEachLine; | 414 textIndentLineValue = TextIndentEachLine; |
| 415 else if (primitiveValue->getValueID() == CSSValueHanging) | 415 else if (primitiveValue.getValueID() == CSSValueHanging) |
| 416 textIndentTypeValue = TextIndentHanging; | 416 textIndentTypeValue = TextIndentHanging; |
| 417 else | 417 else |
| 418 ASSERT_NOT_REACHED(); | 418 ASSERT_NOT_REACHED(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 state.style()->setTextIndent(lengthOrPercentageValue); | 421 state.style()->setTextIndent(lengthOrPercentageValue); |
| 422 state.style()->setTextIndentLine(textIndentLineValue); | 422 state.style()->setTextIndentLine(textIndentLineValue); |
| 423 state.style()->setTextIndentType(textIndentTypeValue); | 423 state.style()->setTextIndentType(textIndentTypeValue); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s
tate, CSSValue* value) | 426 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s
tate, CSSValue value) |
| 427 { | 427 { |
| 428 // FIXME: We should just make this a converter | 428 // FIXME: We should just make this a converter |
| 429 TransformOperations operations; | 429 TransformOperations operations; |
| 430 TransformBuilder::createTransformOperations(*value, state.cssToLengthConvers
ionData(), operations); | 430 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi
onData(), operations); |
| 431 state.style()->setTransform(operations); | 431 state.style()->setTransform(operations); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void StyleBuilderFunctions::applyInheritCSSPropertyMotionPath(StyleResolverState
& state) | 434 void StyleBuilderFunctions::applyInheritCSSPropertyMotionPath(StyleResolverState
& state) |
| 435 { | 435 { |
| 436 if (state.parentStyle()->motionPath()) | 436 if (state.parentStyle()->motionPath()) |
| 437 state.style()->setMotionPath(state.parentStyle()->motionPath()); | 437 state.style()->setMotionPath(state.parentStyle()->motionPath()); |
| 438 else | 438 else |
| 439 state.style()->resetMotionPath(); | 439 state.style()->resetMotionPath(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 void StyleBuilderFunctions::applyValueCSSPropertyMotionPath(StyleResolverState&
state, CSSValue* value) | 442 void StyleBuilderFunctions::applyValueCSSPropertyMotionPath(StyleResolverState&
state, CSSValue value) |
| 443 { | 443 { |
| 444 if (value->isPathValue()) { | 444 if (value.isPathValue()) { |
| 445 const String& pathString = toCSSPathValue(value)->pathString(); | 445 const String& pathString = toCSSPathValue(value).pathString(); |
| 446 state.style()->setMotionPath(PathStyleMotionPath::create(pathString)); | 446 state.style()->setMotionPath(PathStyleMotionPath::create(pathString)); |
| 447 return; | 447 return; |
| 448 } | 448 } |
| 449 | 449 |
| 450 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID()
== CSSValueNone); | 450 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() =
= CSSValueNone); |
| 451 state.style()->resetMotionPath(); | 451 state.style()->resetMotionPath(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void StyleBuilderFunctions::applyInitialCSSPropertyMotionPath(StyleResolverState
& state) | 454 void StyleBuilderFunctions::applyInitialCSSPropertyMotionPath(StyleResolverState
& state) |
| 455 { | 455 { |
| 456 state.style()->resetMotionPath(); | 456 state.style()->resetMotionPath(); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void StyleBuilderFunctions::applyInheritCSSPropertyMotionRotation(StyleResolverS
tate& state) | 459 void StyleBuilderFunctions::applyInheritCSSPropertyMotionRotation(StyleResolverS
tate& state) |
| 460 { | 460 { |
| 461 state.style()->setMotionRotation(state.parentStyle()->motionRotation()); | 461 state.style()->setMotionRotation(state.parentStyle()->motionRotation()); |
| 462 state.style()->setMotionRotationType(state.parentStyle()->motionRotationType
()); | 462 state.style()->setMotionRotationType(state.parentStyle()->motionRotationType
()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 void StyleBuilderFunctions::applyInitialCSSPropertyMotionRotation(StyleResolverS
tate& state) | 465 void StyleBuilderFunctions::applyInitialCSSPropertyMotionRotation(StyleResolverS
tate& state) |
| 466 { | 466 { |
| 467 state.style()->setMotionRotation(ComputedStyle::initialMotionRotation()); | 467 state.style()->setMotionRotation(ComputedStyle::initialMotionRotation()); |
| 468 state.style()->setMotionRotationType(ComputedStyle::initialMotionRotationTyp
e()); | 468 state.style()->setMotionRotationType(ComputedStyle::initialMotionRotationTyp
e()); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void StyleBuilderFunctions::applyValueCSSPropertyMotionRotation(StyleResolverSta
te& state, CSSValue* value) | 471 void StyleBuilderFunctions::applyValueCSSPropertyMotionRotation(StyleResolverSta
te& state, CSSValue value) |
| 472 { | 472 { |
| 473 float rotation = 0; | 473 float rotation = 0; |
| 474 MotionRotationType rotationType = MotionRotationFixed; | 474 MotionRotationType rotationType = MotionRotationFixed; |
| 475 | 475 |
| 476 ASSERT(value->isValueList()); | 476 ASSERT(value.isValueList()); |
| 477 CSSValueList* list = toCSSValueList(value); | 477 CSSValueList& list = toCSSValueList(value); |
| 478 int len = list->length(); | 478 int len = list.length(); |
| 479 for (int i = 0; i < len; i++) { | 479 for (int i = 0; i < len; i++) { |
| 480 CSSValue* item = list->item(i); | 480 CSSValue item = list.item(i); |
| 481 ASSERT(item->isPrimitiveValue()); | 481 ASSERT(item.isPrimitiveValue()); |
| 482 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item); | 482 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item); |
| 483 if (primitiveValue->getValueID() == CSSValueAuto) { | 483 if (primitiveValue.getValueID() == CSSValueAuto) { |
| 484 rotationType = MotionRotationAuto; | 484 rotationType = MotionRotationAuto; |
| 485 } else if (primitiveValue->getValueID() == CSSValueReverse) { | 485 } else if (primitiveValue.getValueID() == CSSValueReverse) { |
| 486 rotationType = MotionRotationAuto; | 486 rotationType = MotionRotationAuto; |
| 487 rotation += 180; | 487 rotation += 180; |
| 488 } else { | 488 } else { |
| 489 rotation += primitiveValue->computeDegrees(); | 489 rotation += primitiveValue.computeDegrees(); |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 state.style()->setMotionRotation(rotation); | 493 state.style()->setMotionRotation(rotation); |
| 494 state.style()->setMotionRotationType(rotationType); | 494 state.style()->setMotionRotationType(rotationType); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) | 497 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) |
| 498 { | 498 { |
| 499 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); | 499 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); |
| 500 state.style()->setVerticalAlign(verticalAlign); | 500 state.style()->setVerticalAlign(verticalAlign); |
| 501 if (verticalAlign == LENGTH) | 501 if (verticalAlign == LENGTH) |
| 502 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign
Length()); | 502 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign
Length()); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, CSSValue* value) | 505 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, CSSValue value) |
| 506 { | 506 { |
| 507 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 507 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 508 | 508 |
| 509 if (primitiveValue->getValueID()) | 509 if (primitiveValue.getValueID()) |
| 510 state.style()->setVerticalAlign(*primitiveValue); | 510 state.style()->setVerticalAlign(primitiveValue); |
| 511 else | 511 else |
| 512 state.style()->setVerticalAlignLength(primitiveValue->convertToLength(st
ate.cssToLengthConversionData())); | 512 state.style()->setVerticalAlignLength(primitiveValue.convertToLength(sta
te.cssToLengthConversionData())); |
| 513 } | 513 } |
| 514 | 514 |
| 515 static void resetEffectiveZoom(StyleResolverState& state) | 515 static void resetEffectiveZoom(StyleResolverState& state) |
| 516 { | 516 { |
| 517 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. | 517 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. |
| 518 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); | 518 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) | 521 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) |
| 522 { | 522 { |
| 523 resetEffectiveZoom(state); | 523 resetEffectiveZoom(state); |
| 524 state.setZoom(ComputedStyle::initialZoom()); | 524 state.setZoom(ComputedStyle::initialZoom()); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) | 527 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) |
| 528 { | 528 { |
| 529 resetEffectiveZoom(state); | 529 resetEffectiveZoom(state); |
| 530 state.setZoom(state.parentStyle()->zoom()); | 530 state.setZoom(state.parentStyle()->zoom()); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
CSSValue* value) | 533 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
CSSValue value) |
| 534 { | 534 { |
| 535 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue()); | 535 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
| 536 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 536 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 537 | 537 |
| 538 if (primitiveValue->getValueID() == CSSValueNormal) { | 538 if (primitiveValue.getValueID() == CSSValueNormal) { |
| 539 resetEffectiveZoom(state); | 539 resetEffectiveZoom(state); |
| 540 state.setZoom(ComputedStyle::initialZoom()); | 540 state.setZoom(ComputedStyle::initialZoom()); |
| 541 } else if (primitiveValue->getValueID() == CSSValueReset) { | 541 } else if (primitiveValue.getValueID() == CSSValueReset) { |
| 542 state.setEffectiveZoom(ComputedStyle::initialZoom()); | 542 state.setEffectiveZoom(ComputedStyle::initialZoom()); |
| 543 state.setZoom(ComputedStyle::initialZoom()); | 543 state.setZoom(ComputedStyle::initialZoom()); |
| 544 } else if (primitiveValue->getValueID() == CSSValueDocument) { | 544 } else if (primitiveValue.getValueID() == CSSValueDocument) { |
| 545 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : ComputedStyle::initialZoom(); | 545 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : ComputedStyle::initialZoom(); |
| 546 state.setEffectiveZoom(docZoom); | 546 state.setEffectiveZoom(docZoom); |
| 547 state.setZoom(docZoom); | 547 state.setZoom(docZoom); |
| 548 } else if (primitiveValue->isPercentage()) { | 548 } else if (primitiveValue.isPercentage()) { |
| 549 resetEffectiveZoom(state); | 549 resetEffectiveZoom(state); |
| 550 if (float percent = primitiveValue->getFloatValue()) | 550 if (float percent = primitiveValue.getFloatValue()) |
| 551 state.setZoom(percent / 100.0f); | 551 state.setZoom(percent / 100.0f); |
| 552 } else if (primitiveValue->isNumber()) { | 552 } else if (primitiveValue.isNumber()) { |
| 553 resetEffectiveZoom(state); | 553 resetEffectiveZoom(state); |
| 554 if (float number = primitiveValue->getFloatValue()) | 554 if (float number = primitiveValue.getFloatValue()) |
| 555 state.setZoom(number); | 555 state.setZoom(number); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, CSSValue* value) | 559 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, CSSValue value) |
| 560 { | 560 { |
| 561 NinePieceImage image; | 561 NinePieceImage image; |
| 562 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); | 562 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); |
| 563 state.style()->setBorderImage(image); | 563 state.style()->setBorderImage(image); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, CSSValue* value) | 566 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, CSSValue value) |
| 567 { | 567 { |
| 568 if (value->isPrimitiveValue()) { | 568 if (value.isPrimitiveValue()) { |
| 569 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 569 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 570 if (primitiveValue->getValueID() == CSSValueNone) { | 570 if (primitiveValue.getValueID() == CSSValueNone) { |
| 571 state.style()->setClipPath(nullptr); | 571 state.style()->setClipPath(nullptr); |
| 572 } else if (primitiveValue->isShape()) { | 572 } else if (primitiveValue.isShape()) { |
| 573 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue->getShapeValue()))); | 573 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue.getShapeValue()))); |
| 574 } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI
) { | 574 } else if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI)
{ |
| 575 String cssURLValue = primitiveValue->getStringValue(); | 575 String cssURLValue = primitiveValue.getStringValue(); |
| 576 KURL url = state.document().completeURL(cssURLValue); | 576 KURL url = state.document().completeURL(cssURLValue); |
| 577 // FIXME: It doesn't work with forward or external SVG references (s
ee https://bugs.webkit.org/show_bug.cgi?id=90405) | 577 // FIXME: It doesn't work with forward or external SVG references (s
ee https://bugs.webkit.org/show_bug.cgi?id=90405) |
| 578 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURL
Value, AtomicString(url.fragmentIdentifier()))); | 578 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURL
Value, AtomicString(url.fragmentIdentifier()))); |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState
& state, CSSValue* value) | 583 void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState
& state, CSSValue value) |
| 584 { | 584 { |
| 585 FilterOperations operations; | 585 FilterOperations operations; |
| 586 if (FilterOperationResolver::createFilterOperations(value, state.cssToLength
ConversionData(), operations, state)) | 586 if (FilterOperationResolver::createFilterOperations(value, state.cssToLength
ConversionData(), operations, state)) |
| 587 state.style()->setFilter(operations); | 587 state.style()->setFilter(operations); |
| 588 } | 588 } |
| 589 | 589 |
| 590 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) | 590 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) |
| 591 { | 591 { |
| 592 state.style()->setTextEmphasisFill(ComputedStyle::initialTextEmphasisFill())
; | 592 state.style()->setTextEmphasisFill(ComputedStyle::initialTextEmphasisFill())
; |
| 593 state.style()->setTextEmphasisMark(ComputedStyle::initialTextEmphasisMark())
; | 593 state.style()->setTextEmphasisMark(ComputedStyle::initialTextEmphasisMark())
; |
| 594 state.style()->setTextEmphasisCustomMark(ComputedStyle::initialTextEmphasisC
ustomMark()); | 594 state.style()->setTextEmphasisCustomMark(ComputedStyle::initialTextEmphasisC
ustomMark()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) | 597 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) |
| 598 { | 598 { |
| 599 state.style()->setTextEmphasisFill(state.parentStyle()->textEmphasisFill()); | 599 state.style()->setTextEmphasisFill(state.parentStyle()->textEmphasisFill()); |
| 600 state.style()->setTextEmphasisMark(state.parentStyle()->textEmphasisMark()); | 600 state.style()->setTextEmphasisMark(state.parentStyle()->textEmphasisMark()); |
| 601 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); | 601 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, CSSValue* value) | 604 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, CSSValue value) |
| 605 { | 605 { |
| 606 if (value->isValueList()) { | 606 if (value.isValueList()) { |
| 607 CSSValueList* list = toCSSValueList(value); | 607 CSSValueList& list = toCSSValueList(value); |
| 608 ASSERT(list->length() == 2); | 608 ASSERT(list.length() == 2); |
| 609 for (unsigned i = 0; i < 2; ++i) { | 609 for (unsigned i = 0; i < 2; ++i) { |
| 610 CSSPrimitiveValue* value = toCSSPrimitiveValue(list->item(i)); | 610 CSSPrimitiveValue& value = toCSSPrimitiveValue(list.item(i)); |
| 611 if (value->getValueID() == CSSValueFilled || value->getValueID() ==
CSSValueOpen) | 611 if (value.getValueID() == CSSValueFilled || value.getValueID() == CS
SValueOpen) |
| 612 state.style()->setTextEmphasisFill(*value); | 612 state.style()->setTextEmphasisFill(value); |
| 613 else | 613 else |
| 614 state.style()->setTextEmphasisMark(*value); | 614 state.style()->setTextEmphasisMark(value); |
| 615 } | 615 } |
| 616 state.style()->setTextEmphasisCustomMark(nullAtom); | 616 state.style()->setTextEmphasisCustomMark(nullAtom); |
| 617 return; | 617 return; |
| 618 } | 618 } |
| 619 | 619 |
| 620 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 620 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 621 | 621 |
| 622 if (primitiveValue->isString()) { | 622 if (primitiveValue.isString()) { |
| 623 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 623 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
| 624 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); | 624 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); |
| 625 state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue->ge
tStringValue())); | 625 state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue.get
StringValue())); |
| 626 return; | 626 return; |
| 627 } | 627 } |
| 628 | 628 |
| 629 state.style()->setTextEmphasisCustomMark(nullAtom); | 629 state.style()->setTextEmphasisCustomMark(nullAtom); |
| 630 | 630 |
| 631 if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getVal
ueID() == CSSValueOpen) { | 631 if (primitiveValue.getValueID() == CSSValueFilled || primitiveValue.getValue
ID() == CSSValueOpen) { |
| 632 state.style()->setTextEmphasisFill(*primitiveValue); | 632 state.style()->setTextEmphasisFill(primitiveValue); |
| 633 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); | 633 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); |
| 634 } else { | 634 } else { |
| 635 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 635 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
| 636 state.style()->setTextEmphasisMark(*primitiveValue); | 636 state.style()->setTextEmphasisMark(primitiveValue); |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 | 639 |
| 640 void StyleBuilderFunctions::applyInitialCSSPropertyWillChange(StyleResolverState
& state) | 640 void StyleBuilderFunctions::applyInitialCSSPropertyWillChange(StyleResolverState
& state) |
| 641 { | 641 { |
| 642 state.style()->setWillChangeContents(false); | 642 state.style()->setWillChangeContents(false); |
| 643 state.style()->setWillChangeScrollPosition(false); | 643 state.style()->setWillChangeScrollPosition(false); |
| 644 state.style()->setWillChangeProperties(Vector<CSSPropertyID>()); | 644 state.style()->setWillChangeProperties(Vector<CSSPropertyID>()); |
| 645 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); | 645 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void StyleBuilderFunctions::applyInheritCSSPropertyWillChange(StyleResolverState
& state) | 648 void StyleBuilderFunctions::applyInheritCSSPropertyWillChange(StyleResolverState
& state) |
| 649 { | 649 { |
| 650 state.style()->setWillChangeContents(state.parentStyle()->willChangeContents
()); | 650 state.style()->setWillChangeContents(state.parentStyle()->willChangeContents
()); |
| 651 state.style()->setWillChangeScrollPosition(state.parentStyle()->willChangeSc
rollPosition()); | 651 state.style()->setWillChangeScrollPosition(state.parentStyle()->willChangeSc
rollPosition()); |
| 652 state.style()->setWillChangeProperties(state.parentStyle()->willChangeProper
ties()); | 652 state.style()->setWillChangeProperties(state.parentStyle()->willChangeProper
ties()); |
| 653 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); | 653 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, CSSValue* value) | 656 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, CSSValue value) |
| 657 { | 657 { |
| 658 ASSERT(value->isValueList()); | 658 ASSERT(value.isValueList()); |
| 659 bool willChangeContents = false; | 659 bool willChangeContents = false; |
| 660 bool willChangeScrollPosition = false; | 660 bool willChangeScrollPosition = false; |
| 661 Vector<CSSPropertyID> willChangeProperties; | 661 Vector<CSSPropertyID> willChangeProperties; |
| 662 | 662 |
| 663 for (auto& willChangeValue : toCSSValueList(*value)) { | 663 for (auto& willChangeValue : toCSSValueList(value)) { |
| 664 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(willChangeValue.
get()); | 664 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(willChangeValue)
; |
| 665 if (CSSPropertyID propertyID = primitiveValue->getPropertyID()) | 665 if (CSSPropertyID propertyID = primitiveValue.getPropertyID()) |
| 666 willChangeProperties.append(propertyID); | 666 willChangeProperties.append(propertyID); |
| 667 else if (primitiveValue->getValueID() == CSSValueContents) | 667 else if (primitiveValue.getValueID() == CSSValueContents) |
| 668 willChangeContents = true; | 668 willChangeContents = true; |
| 669 else if (primitiveValue->getValueID() == CSSValueScrollPosition) | 669 else if (primitiveValue.getValueID() == CSSValueScrollPosition) |
| 670 willChangeScrollPosition = true; | 670 willChangeScrollPosition = true; |
| 671 else | 671 else |
| 672 ASSERT_NOT_REACHED(); | 672 ASSERT_NOT_REACHED(); |
| 673 } | 673 } |
| 674 state.style()->setWillChangeContents(willChangeContents); | 674 state.style()->setWillChangeContents(willChangeContents); |
| 675 state.style()->setWillChangeScrollPosition(willChangeScrollPosition); | 675 state.style()->setWillChangeScrollPosition(willChangeScrollPosition); |
| 676 state.style()->setWillChangeProperties(willChangeProperties); | 676 state.style()->setWillChangeProperties(willChangeProperties); |
| 677 state.style()->setSubtreeWillChangeContents(willChangeContents || state.pare
ntStyle()->subtreeWillChangeContents()); | 677 state.style()->setSubtreeWillChangeContents(willChangeContents || state.pare
ntStyle()->subtreeWillChangeContents()); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void StyleBuilderFunctions::applyInitialCSSPropertyContent(StyleResolverState& s
tate) | 680 void StyleBuilderFunctions::applyInitialCSSPropertyContent(StyleResolverState& s
tate) |
| 681 { | 681 { |
| 682 state.style()->clearContent(); | 682 state.style()->clearContent(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) | 685 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) |
| 686 { | 686 { |
| 687 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not
. This | 687 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not
. This |
| 688 // note is a reminder that eventually "inherit" needs to be supported. | 688 // note is a reminder that eventually "inherit" needs to be supported. |
| 689 } | 689 } |
| 690 | 690 |
| 691 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
te, CSSValue* value) | 691 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
te, CSSValue value) |
| 692 { | 692 { |
| 693 // list of string, uri, counter, attr, i | 693 // list of string, uri, counter, attr, i |
| 694 | 694 |
| 695 bool didSet = false; | 695 bool didSet = false; |
| 696 for (auto& item : toCSSValueList(*value)) { | 696 for (auto& item : toCSSValueList(value)) { |
| 697 if (item->isImageGeneratorValue()) { | 697 if (item.isImageGeneratorValue()) { |
| 698 state.style()->setContent(StyleGeneratedImage::create(toCSSImageGene
ratorValue(item.get())), didSet); | 698 state.style()->setContent(StyleGeneratedImage::create(&toCSSImageGen
eratorValue(item)), didSet); |
| 699 didSet = true; | 699 didSet = true; |
| 700 } else if (item->isImageSetValue()) { | 700 } else if (item.isImageSetValue()) { |
| 701 state.style()->setContent(state.elementStyleResources().setOrPending
FromValue(CSSPropertyContent, toCSSImageSetValue(item.get())), didSet); | 701 state.style()->setContent(state.elementStyleResources().setOrPending
FromValue(CSSPropertyContent, toCSSImageSetValue(item)), didSet); |
| 702 didSet = true; | 702 didSet = true; |
| 703 } | 703 } |
| 704 | 704 |
| 705 if (item->isImageValue()) { | 705 if (item.isImageValue()) { |
| 706 state.style()->setContent(state.elementStyleResources().cachedOrPend
ingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item.get())),
didSet); | 706 state.style()->setContent(state.elementStyleResources().cachedOrPend
ingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item)), didSe
t); |
| 707 didSet = true; | 707 didSet = true; |
| 708 continue; | 708 continue; |
| 709 } | 709 } |
| 710 | 710 |
| 711 if (!item->isPrimitiveValue()) | 711 if (!item.isPrimitiveValue()) |
| 712 continue; | 712 continue; |
| 713 | 713 |
| 714 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get()); | 714 CSSPrimitiveValue& contentValue = toCSSPrimitiveValue(item); |
| 715 | 715 |
| 716 if (contentValue->isString()) { | 716 if (contentValue.isString()) { |
| 717 state.style()->setContent(contentValue->getStringValue().impl(), did
Set); | 717 state.style()->setContent(contentValue.getStringValue().impl(), didS
et); |
| 718 didSet = true; | 718 didSet = true; |
| 719 } else if (contentValue->isAttr()) { | 719 } else if (contentValue.isAttr()) { |
| 720 // FIXME: Can a namespace be specified for an attr(foo)? | 720 // FIXME: Can a namespace be specified for an attr(foo)? |
| 721 if (state.style()->styleType() == NOPSEUDO) | 721 if (state.style()->styleType() == NOPSEUDO) |
| 722 state.style()->setUnique(); | 722 state.style()->setUnique(); |
| 723 else | 723 else |
| 724 state.parentStyle()->setUnique(); | 724 state.parentStyle()->setUnique(); |
| 725 QualifiedName attr(nullAtom, AtomicString(contentValue->getStringVal
ue()), nullAtom); | 725 QualifiedName attr(nullAtom, AtomicString(contentValue.getStringValu
e()), nullAtom); |
| 726 const AtomicString& value = state.element()->getAttribute(attr); | 726 const AtomicString& value = state.element()->getAttribute(attr); |
| 727 state.style()->setContent(value.isNull() ? emptyString() : value.str
ing(), didSet); | 727 state.style()->setContent(value.isNull() ? emptyString() : value.str
ing(), didSet); |
| 728 didSet = true; | 728 didSet = true; |
| 729 } else if (contentValue->isCounter()) { | 729 } else if (contentValue.isCounter()) { |
| 730 Counter* counterValue = contentValue->getCounterValue(); | 730 Counter* counterValue = contentValue.getCounterValue(); |
| 731 EListStyleType listStyleType = NoneListStyle; | 731 EListStyleType listStyleType = NoneListStyle; |
| 732 CSSValueID listStyleIdent = counterValue->listStyleIdent(); | 732 CSSValueID listStyleIdent = counterValue->listStyleIdent(); |
| 733 if (listStyleIdent != CSSValueNone) | 733 if (listStyleIdent != CSSValueNone) |
| 734 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS
ValueDisc); | 734 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS
ValueDisc); |
| 735 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicS
tring(counterValue->identifier()), listStyleType, AtomicString(counterValue->sep
arator()))); | 735 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicS
tring(counterValue->identifier()), listStyleType, AtomicString(counterValue->sep
arator()))); |
| 736 state.style()->setContent(counter.release(), didSet); | 736 state.style()->setContent(counter.release(), didSet); |
| 737 didSet = true; | 737 didSet = true; |
| 738 } else { | 738 } else { |
| 739 switch (contentValue->getValueID()) { | 739 switch (contentValue.getValueID()) { |
| 740 case CSSValueOpenQuote: | 740 case CSSValueOpenQuote: |
| 741 state.style()->setContent(OPEN_QUOTE, didSet); | 741 state.style()->setContent(OPEN_QUOTE, didSet); |
| 742 didSet = true; | 742 didSet = true; |
| 743 break; | 743 break; |
| 744 case CSSValueCloseQuote: | 744 case CSSValueCloseQuote: |
| 745 state.style()->setContent(CLOSE_QUOTE, didSet); | 745 state.style()->setContent(CLOSE_QUOTE, didSet); |
| 746 didSet = true; | 746 didSet = true; |
| 747 break; | 747 break; |
| 748 case CSSValueNoOpenQuote: | 748 case CSSValueNoOpenQuote: |
| 749 state.style()->setContent(NO_OPEN_QUOTE, didSet); | 749 state.style()->setContent(NO_OPEN_QUOTE, didSet); |
| 750 didSet = true; | 750 didSet = true; |
| 751 break; | 751 break; |
| 752 case CSSValueNoCloseQuote: | 752 case CSSValueNoCloseQuote: |
| 753 state.style()->setContent(NO_CLOSE_QUOTE, didSet); | 753 state.style()->setContent(NO_CLOSE_QUOTE, didSet); |
| 754 didSet = true; | 754 didSet = true; |
| 755 break; | 755 break; |
| 756 default: | 756 default: |
| 757 // normal and none do not have any effect. | 757 // normal and none do not have any effect. |
| 758 { } | 758 { } |
| 759 } | 759 } |
| 760 } | 760 } |
| 761 } | 761 } |
| 762 if (!didSet) | 762 if (!didSet) |
| 763 state.style()->clearContent(); | 763 state.style()->clearContent(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) | 766 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue value) |
| 767 { | 767 { |
| 768 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 768 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 769 if (primitiveValue->getValueID() == CSSValueAuto) | 769 if (primitiveValue.getValueID() == CSSValueAuto) |
| 770 state.style()->setLocale(nullAtom); | 770 state.style()->setLocale(nullAtom); |
| 771 else | 771 else |
| 772 state.style()->setLocale(AtomicString(primitiveValue->getStringValue()))
; | 772 state.style()->setLocale(AtomicString(primitiveValue.getStringValue())); |
| 773 state.fontBuilder().setScript(state.style()->locale()); | 773 state.fontBuilder().setScript(state.style()->locale()); |
| 774 } | 774 } |
| 775 | 775 |
| 776 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) | 776 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) |
| 777 { | 777 { |
| 778 } | 778 } |
| 779 | 779 |
| 780 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) | 780 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) |
| 781 { | 781 { |
| 782 } | 782 } |
| 783 | 783 |
| 784 void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverSt
ate& state, CSSValue* value) | 784 void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverSt
ate& state, CSSValue value) |
| 785 { | 785 { |
| 786 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 786 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 787 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSVal
ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); | 787 state.style()->setDraggableRegionMode(primitiveValue.getValueID() == CSSValu
eDrag ? DraggableRegionDrag : DraggableRegionNoDrag); |
| 788 state.document().setHasAnnotatedRegions(true); | 788 state.document().setHasAnnotatedRegions(true); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, CSSValue* value) | 791 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, CSSValue value) |
| 792 { | 792 { |
| 793 state.setWritingMode(*toCSSPrimitiveValue(value)); | 793 state.setWritingMode(toCSSPrimitiveValue(value)); |
| 794 } | 794 } |
| 795 | 795 |
| 796 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) | 796 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue value) |
| 797 { | 797 { |
| 798 state.setTextOrientation(*toCSSPrimitiveValue(value)); | 798 state.setTextOrientation(toCSSPrimitiveValue(value)); |
| 799 } | 799 } |
| 800 | 800 |
| 801 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
ate& state) | 801 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
ate& state) |
| 802 { | 802 { |
| 803 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); | 803 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); |
| 804 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); | 804 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); |
| 805 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 805 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
| 806 svgStyle.setBaselineShift(baselineShift); | 806 svgStyle.setBaselineShift(baselineShift); |
| 807 if (baselineShift == BS_LENGTH) | 807 if (baselineShift == BS_LENGTH) |
| 808 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); | 808 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); |
| 809 } | 809 } |
| 810 | 810 |
| 811 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, CSSValue* value) | 811 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, CSSValue value) |
| 812 { | 812 { |
| 813 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 813 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
| 814 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 814 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 815 if (!primitiveValue->isValueID()) { | 815 if (!primitiveValue.isValueID()) { |
| 816 svgStyle.setBaselineShift(BS_LENGTH); | 816 svgStyle.setBaselineShift(BS_LENGTH); |
| 817 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, primitiveValue)); | 817 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, value)); |
| 818 return; | 818 return; |
| 819 } | 819 } |
| 820 switch (primitiveValue->getValueID()) { | 820 switch (primitiveValue.getValueID()) { |
| 821 case CSSValueBaseline: | 821 case CSSValueBaseline: |
| 822 svgStyle.setBaselineShift(BS_LENGTH); | 822 svgStyle.setBaselineShift(BS_LENGTH); |
| 823 svgStyle.setBaselineShiftValue(Length(Fixed)); | 823 svgStyle.setBaselineShiftValue(Length(Fixed)); |
| 824 return; | 824 return; |
| 825 case CSSValueSub: | 825 case CSSValueSub: |
| 826 svgStyle.setBaselineShift(BS_SUB); | 826 svgStyle.setBaselineShift(BS_SUB); |
| 827 return; | 827 return; |
| 828 case CSSValueSuper: | 828 case CSSValueSuper: |
| 829 svgStyle.setBaselineShift(BS_SUPER); | 829 svgStyle.setBaselineShift(BS_SUPER); |
| 830 return; | 830 return; |
| 831 default: | 831 default: |
| 832 ASSERT_NOT_REACHED(); | 832 ASSERT_NOT_REACHED(); |
| 833 } | 833 } |
| 834 } | 834 } |
| 835 | 835 |
| 836 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |