Changeset 160539 in webkit
- Timestamp:
- Dec 13, 2013 1:56:26 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r160536 r160539 1 2013-12-12 Andreas Kling <akling@apple.com> 2 3 StyleResolver::adjustRenderStyle() should take RenderStyle references. 4 <https://webkit.org/b/125623> 5 6 This function doesn't handle null styles being passed, so prevent 7 it at compile time. 8 9 Reviewed by Anders Carlsson. 10 1 11 2013-12-13 Darin Adler <darin@apple.com> 2 12 -
trunk/Source/WebCore/css/StyleResolver.cpp
r160528 r160539 845 845 846 846 // Clean up our style object's display and text decorations (among other fixups). 847 adjustRenderStyle( state.style(),state.parentStyle(), element);847 adjustRenderStyle(*state.style(), *state.parentStyle(), element); 848 848 849 849 state.clear(); // Clear out for the next resolve. … … 1010 1010 1011 1011 // Clean up our style object's display and text decorations (among other fixups). 1012 adjustRenderStyle( state.style(),m_state.parentStyle(), 0);1012 adjustRenderStyle(*state.style(), *m_state.parentStyle(), 0); 1013 1013 1014 1014 // Start loading resources referenced by this style. … … 1067 1067 } 1068 1068 1069 static void addIntrinsicMargins(RenderStyle *style)1069 static void addIntrinsicMargins(RenderStyle& style) 1070 1070 { 1071 1071 // Intrinsic margin value. 1072 const int intrinsicMargin = 2 * style ->effectiveZoom();1072 const int intrinsicMargin = 2 * style.effectiveZoom(); 1073 1073 1074 1074 // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed. 1075 1075 // FIXME: Using "quirk" to decide the margin wasn't set is kind of lame. 1076 if (style ->width().isIntrinsicOrAuto()) {1077 if (style ->marginLeft().quirk())1078 style ->setMarginLeft(Length(intrinsicMargin, Fixed));1079 if (style ->marginRight().quirk())1080 style ->setMarginRight(Length(intrinsicMargin, Fixed));1081 } 1082 1083 if (style ->height().isAuto()) {1084 if (style ->marginTop().quirk())1085 style ->setMarginTop(Length(intrinsicMargin, Fixed));1086 if (style ->marginBottom().quirk())1087 style ->setMarginBottom(Length(intrinsicMargin, Fixed));1076 if (style.width().isIntrinsicOrAuto()) { 1077 if (style.marginLeft().quirk()) 1078 style.setMarginLeft(Length(intrinsicMargin, Fixed)); 1079 if (style.marginRight().quirk()) 1080 style.setMarginRight(Length(intrinsicMargin, Fixed)); 1081 } 1082 1083 if (style.height().isAuto()) { 1084 if (style.marginTop().quirk()) 1085 style.setMarginTop(Length(intrinsicMargin, Fixed)); 1086 if (style.marginBottom().quirk()) 1087 style.setMarginBottom(Length(intrinsicMargin, Fixed)); 1088 1088 } 1089 1089 } … … 1137 1137 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating elements, 1138 1138 // and absolute or relatively positioned elements. 1139 static bool doesNotInheritTextDecoration( RenderStyle*style, Element* e)1140 { 1141 return style ->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN1142 || style ->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)1143 || style ->isFloating() || style->hasOutOfFlowPosition();1139 static bool doesNotInheritTextDecoration(const RenderStyle& style, Element* e) 1140 { 1141 return style.display() == TABLE || style.display() == INLINE_TABLE || style.display() == RUN_IN 1142 || style.display() == INLINE_BLOCK || style.display() == INLINE_BOX || isAtShadowBoundary(e) 1143 || style.isFloating() || style.hasOutOfFlowPosition(); 1144 1144 } 1145 1145 … … 1156 1156 #endif 1157 1157 1158 void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) 1159 { 1160 ASSERT(parentStyle); 1161 1158 void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& parentStyle, Element *e) 1159 { 1162 1160 // Cache our original display. 1163 style ->setOriginalDisplay(style->display());1164 1165 if (style ->display() != NONE) {1161 style.setOriginalDisplay(style.display()); 1162 1163 if (style.display() != NONE) { 1166 1164 // If we have a <td> that specifies a float property, in quirks mode we just drop the float 1167 1165 // property. … … 1170 1168 if (document().inQuirksMode() && e) { 1171 1169 if (e->hasTagName(tdTag)) { 1172 style ->setDisplay(TABLE_CELL);1173 style ->setFloating(NoFloat);1170 style.setDisplay(TABLE_CELL); 1171 style.setFloating(NoFloat); 1174 1172 } else if (isHTMLTableElement(e)) 1175 style ->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);1173 style.setDisplay(style.isDisplayInlineType() ? INLINE_TABLE : TABLE); 1176 1174 } 1177 1175 1178 1176 if (e && (e->hasTagName(tdTag) || e->hasTagName(thTag))) { 1179 if (style ->whiteSpace() == KHTML_NOWRAP) {1177 if (style.whiteSpace() == KHTML_NOWRAP) { 1180 1178 // Figure out if we are really nowrapping or if we should just 1181 1179 // use normal instead. If the width of the cell is fixed, then 1182 1180 // we don't actually use NOWRAP. 1183 if (style ->width().isFixed())1184 style ->setWhiteSpace(NORMAL);1181 if (style.width().isFixed()) 1182 style.setWhiteSpace(NORMAL); 1185 1183 else 1186 style ->setWhiteSpace(NOWRAP);1184 style.setWhiteSpace(NOWRAP); 1187 1185 } 1188 1186 } 1189 1187 1190 1188 // Tables never support the -webkit-* values for text-align and will reset back to the default. 1191 if (e && isHTMLTableElement(e) && (style ->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))1192 style ->setTextAlign(TASTART);1189 if (e && isHTMLTableElement(e) && (style.textAlign() == WEBKIT_LEFT || style.textAlign() == WEBKIT_CENTER || style.textAlign() == WEBKIT_RIGHT)) 1190 style.setTextAlign(TASTART); 1193 1191 1194 1192 // Frames and framesets never honor position:relative or position:absolute. This is necessary to 1195 1193 // fix a crash where a site tries to position these objects. They also never honor display. 1196 1194 if (e && (e->hasTagName(frameTag) || e->hasTagName(framesetTag))) { 1197 style ->setPosition(StaticPosition);1198 style ->setDisplay(BLOCK);1195 style.setPosition(StaticPosition); 1196 style.setDisplay(BLOCK); 1199 1197 } 1200 1198 1201 1199 // Ruby text does not support float or position. This might change with evolution of the specification. 1202 1200 if (e && e->hasTagName(rtTag)) { 1203 style ->setPosition(StaticPosition);1204 style ->setFloating(NoFloat);1201 style.setPosition(StaticPosition); 1202 style.setFloating(NoFloat); 1205 1203 } 1206 1204 1207 1205 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead. 1208 1206 // Table headers with a text-align of -webkit-auto will change the text-align to center. 1209 if (e && e->hasTagName(thTag) && style ->textAlign() == TASTART)1210 style ->setTextAlign(CENTER);1207 if (e && e->hasTagName(thTag) && style.textAlign() == TASTART) 1208 style.setTextAlign(CENTER); 1211 1209 1212 1210 if (e && e->hasTagName(legendTag)) 1213 style ->setDisplay(BLOCK);1211 style.setDisplay(BLOCK); 1214 1212 1215 1213 // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. 1216 if (style ->hasOutOfFlowPosition() || style->isFloating() || (e && e->document().documentElement() == e))1217 style ->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document().inQuirksMode()));1214 if (style.hasOutOfFlowPosition() || style.isFloating() || (e && e->document().documentElement() == e)) 1215 style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloating(), !document().inQuirksMode())); 1218 1216 1219 1217 // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely 1220 1218 // clear how that should work. 1221 if (style ->display() == INLINE && style->styleType() == NOPSEUDO && style->writingMode() != parentStyle->writingMode())1222 style ->setDisplay(INLINE_BLOCK);1219 if (style.display() == INLINE && style.styleType() == NOPSEUDO && style.writingMode() != parentStyle.writingMode()) 1220 style.setDisplay(INLINE_BLOCK); 1223 1221 1224 1222 // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on 1225 1223 // table rows or cells. This has been established for position:relative in CSS2.1 (and caused a crash in containingBlock() 1226 1224 // on some sites). 1227 if ((style ->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP1228 || style ->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW)1229 && style ->hasInFlowPosition())1230 style ->setPosition(StaticPosition);1225 if ((style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_ROW_GROUP 1226 || style.display() == TABLE_FOOTER_GROUP || style.display() == TABLE_ROW) 1227 && style.hasInFlowPosition()) 1228 style.setPosition(StaticPosition); 1231 1229 1232 1230 // writing-mode does not apply to table row groups, table column groups, table rows, and table columns. 1233 1231 // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though. 1234 if (style ->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_FOOTER_GROUP1235 || style ->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_ROW_GROUP1236 || style ->display() == TABLE_CELL)1237 style ->setWritingMode(parentStyle->writingMode());1232 if (style.display() == TABLE_COLUMN || style.display() == TABLE_COLUMN_GROUP || style.display() == TABLE_FOOTER_GROUP 1233 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_ROW || style.display() == TABLE_ROW_GROUP 1234 || style.display() == TABLE_CELL) 1235 style.setWritingMode(parentStyle.writingMode()); 1238 1236 1239 1237 // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting 1240 1238 // of block-flow to anything other than TopToBottomWritingMode. 1241 1239 // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. 1242 if (style ->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))1243 style ->setWritingMode(TopToBottomWritingMode);1244 1245 if (isDisplayFlexibleBox(parentStyle ->display())) {1246 style ->setFloating(NoFloat);1247 style ->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document().inQuirksMode()));1240 if (style.writingMode() != TopToBottomWritingMode && (style.display() == BOX || style.display() == INLINE_BOX)) 1241 style.setWritingMode(TopToBottomWritingMode); 1242 1243 if (isDisplayFlexibleBox(parentStyle.display())) { 1244 style.setFloating(NoFloat); 1245 style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloating(), !document().inQuirksMode())); 1248 1246 } 1249 1247 } 1250 1248 1251 1249 // Make sure our z-index value is only applied if the object is positioned. 1252 if (style ->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display()))1253 style ->setHasAutoZIndex();1250 if (style.position() == StaticPosition && !isDisplayFlexibleBox(parentStyle.display())) 1251 style.setHasAutoZIndex(); 1254 1252 1255 1253 // Auto z-index becomes 0 for the root element and transparent objects. This prevents 1256 1254 // cases where objects that should be blended as a single unit end up with a non-transparent 1257 1255 // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections. 1258 if (style ->hasAutoZIndex() && ((e && e->document().documentElement() == e)1259 || style ->opacity() < 1.0f1260 || style ->hasTransformRelatedProperty()1261 || style ->hasMask()1262 || style ->clipPath()1263 || style ->boxReflect()1264 || style ->hasFilter()1265 || style ->hasBlendMode()1266 || style ->position() == StickyPosition1267 || (style ->position() == FixedPosition && e && e->document().page() && e->document().page()->settings().fixedPositionCreatesStackingContext())1268 || style ->hasFlowFrom()1256 if (style.hasAutoZIndex() && ((e && e->document().documentElement() == e) 1257 || style.opacity() < 1.0f 1258 || style.hasTransformRelatedProperty() 1259 || style.hasMask() 1260 || style.clipPath() 1261 || style.boxReflect() 1262 || style.hasFilter() 1263 || style.hasBlendMode() 1264 || style.position() == StickyPosition 1265 || (style.position() == FixedPosition && e && e->document().page() && e->document().page()->settings().fixedPositionCreatesStackingContext()) 1266 || style.hasFlowFrom() 1269 1267 )) 1270 style ->setZIndex(0);1268 style.setZIndex(0); 1271 1269 1272 1270 // Textarea considers overflow visible as auto. 1273 1271 if (e && isHTMLTextAreaElement(e)) { 1274 style ->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX());1275 style ->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY());1272 style.setOverflowX(style.overflowX() == OVISIBLE ? OAUTO : style.overflowX()); 1273 style.setOverflowY(style.overflowY() == OVISIBLE ? OAUTO : style.overflowY()); 1276 1274 } 1277 1275 1278 1276 if (doesNotInheritTextDecoration(style, e)) 1279 style ->setTextDecorationsInEffect(style->textDecoration());1277 style.setTextDecorationsInEffect(style.textDecoration()); 1280 1278 else 1281 style ->addToTextDecorationsInEffect(style->textDecoration());1279 style.addToTextDecorationsInEffect(style.textDecoration()); 1282 1280 1283 1281 // If either overflow value is not visible, change to auto. 1284 if (style ->overflowX() == OMARQUEE && style->overflowY() != OMARQUEE)1285 style ->setOverflowY(OMARQUEE);1286 else if (style ->overflowY() == OMARQUEE && style->overflowX() != OMARQUEE)1287 style ->setOverflowX(OMARQUEE);1288 else if (style ->overflowX() == OVISIBLE && style->overflowY() != OVISIBLE) {1282 if (style.overflowX() == OMARQUEE && style.overflowY() != OMARQUEE) 1283 style.setOverflowY(OMARQUEE); 1284 else if (style.overflowY() == OMARQUEE && style.overflowX() != OMARQUEE) 1285 style.setOverflowX(OMARQUEE); 1286 else if (style.overflowX() == OVISIBLE && style.overflowY() != OVISIBLE) { 1289 1287 // FIXME: Once we implement pagination controls, overflow-x should default to hidden 1290 1288 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it 1291 1289 // default to auto so we can at least scroll through the pages. 1292 style ->setOverflowX(OAUTO);1293 } else if (style ->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE)1294 style ->setOverflowY(OAUTO);1290 style.setOverflowX(OAUTO); 1291 } else if (style.overflowY() == OVISIBLE && style.overflowX() != OVISIBLE) 1292 style.setOverflowY(OAUTO); 1295 1293 1296 1294 // Call setStylesForPaginationMode() if a pagination mode is set for any non-root elements. If these 1297 1295 // styles are specified on a root element, then they will be incorporated in 1298 1296 // Style::createForDocument(). 1299 if ((style ->overflowY() == OPAGEDX || style->overflowY() == OPAGEDY) && !(e && (e->hasTagName(htmlTag) || e->hasTagName(bodyTag))))1300 style ->setColumnStylesFromPaginationMode(WebCore::paginationModeForRenderStyle(style));1297 if ((style.overflowY() == OPAGEDX || style.overflowY() == OPAGEDY) && !(e && (e->hasTagName(htmlTag) || e->hasTagName(bodyTag)))) 1298 style.setColumnStylesFromPaginationMode(WebCore::paginationModeForRenderStyle(style)); 1301 1299 1302 1300 // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto. 1303 1301 // FIXME: Eventually table sections will support auto and scroll. 1304 if (style ->display() == TABLE || style->display() == INLINE_TABLE1305 || style ->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {1306 if (style ->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)1307 style ->setOverflowX(OVISIBLE);1308 if (style ->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)1309 style ->setOverflowY(OVISIBLE);1302 if (style.display() == TABLE || style.display() == INLINE_TABLE 1303 || style.display() == TABLE_ROW_GROUP || style.display() == TABLE_ROW) { 1304 if (style.overflowX() != OVISIBLE && style.overflowX() != OHIDDEN) 1305 style.setOverflowX(OVISIBLE); 1306 if (style.overflowY() != OVISIBLE && style.overflowY() != OHIDDEN) 1307 style.setOverflowY(OVISIBLE); 1310 1308 } 1311 1309 1312 1310 // Menulists should have visible overflow 1313 if (style ->appearance() == MenulistPart) {1314 style ->setOverflowX(OVISIBLE);1315 style ->setOverflowY(OVISIBLE);1311 if (style.appearance() == MenulistPart) { 1312 style.setOverflowX(OVISIBLE); 1313 style.setOverflowY(OVISIBLE); 1316 1314 } 1317 1315 1318 1316 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 1319 1317 // Touch overflow scrolling creates a stacking context. 1320 if (style ->hasAutoZIndex() && style->useTouchOverflowScrolling() && (isScrollableOverflow(style->overflowX()) || isScrollableOverflow(style->overflowY())))1321 style ->setZIndex(0);1318 if (style.hasAutoZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY()))) 1319 style.setZIndex(0); 1322 1320 #endif 1323 1321 1324 1322 // Cull out any useless layers and also repeat patterns into additional layers. 1325 style ->adjustBackgroundLayers();1326 style ->adjustMaskLayers();1323 style.adjustBackgroundLayers(); 1324 style.adjustMaskLayers(); 1327 1325 1328 1326 // Do the same for animations and transitions. 1329 style ->adjustAnimations();1330 style ->adjustTransitions();1327 style.adjustAnimations(); 1328 style.adjustTransitions(); 1331 1329 1332 1330 // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will 1333 1331 // alter fonts and heights/widths. 1334 if (e && e->isFormControlElement() && style ->fontSize() >= 11) {1332 if (e && e->isFormControlElement() && style.fontSize() >= 11) { 1335 1333 // Don't apply intrinsic margins to image buttons. The designer knows how big the images are, 1336 1334 // so we have to treat all image buttons as though they were explicitly sized. … … 1340 1338 1341 1339 // Let the theme also have a crack at adjusting the style. 1342 if (style ->hasAppearance())1343 RenderTheme::defaultTheme()->adjustStyle( this, style, e, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor());1340 if (style.hasAppearance()) 1341 RenderTheme::defaultTheme()->adjustStyle(*this, style, e, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor()); 1344 1342 1345 1343 // If we have first-letter pseudo style, do not share this style. 1346 if (style ->hasPseudoStyle(FIRST_LETTER))1347 style ->setUnique();1344 if (style.hasPseudoStyle(FIRST_LETTER)) 1345 style.setUnique(); 1348 1346 1349 1347 // FIXME: when dropping the -webkit prefix on transform-style, we should also have opacity < 1 cause flattening. 1350 if (style ->preserves3D() && (style->overflowX() != OVISIBLE1351 || style ->overflowY() != OVISIBLE1352 || style ->hasFilter()))1353 style ->setTransformStyle3D(TransformStyle3DFlat);1348 if (style.preserves3D() && (style.overflowX() != OVISIBLE 1349 || style.overflowY() != OVISIBLE 1350 || style.hasFilter())) 1351 style.setTransformStyle3D(TransformStyle3DFlat); 1354 1352 1355 1353 // Seamless iframes behave like blocks. Map their display to inline-block when marked inline. 1356 if (e && e->hasTagName(iframeTag) && style ->display() == INLINE && toHTMLIFrameElement(e)->shouldDisplaySeamlessly())1357 style ->setDisplay(INLINE_BLOCK);1354 if (e && e->hasTagName(iframeTag) && style.display() == INLINE && toHTMLIFrameElement(e)->shouldDisplaySeamlessly()) 1355 style.setDisplay(INLINE_BLOCK); 1358 1356 1359 1357 adjustGridItemPosition(style, parentStyle); … … 1362 1360 if (e && e->isSVGElement()) { 1363 1361 // Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty 1364 if (style ->overflowY() == OSCROLL)1365 style ->setOverflowY(OHIDDEN);1366 else if (style ->overflowY() == OAUTO)1367 style ->setOverflowY(OVISIBLE);1368 1369 if (style ->overflowX() == OSCROLL)1370 style ->setOverflowX(OHIDDEN);1371 else if (style ->overflowX() == OAUTO)1372 style ->setOverflowX(OVISIBLE);1362 if (style.overflowY() == OSCROLL) 1363 style.setOverflowY(OHIDDEN); 1364 else if (style.overflowY() == OAUTO) 1365 style.setOverflowY(OVISIBLE); 1366 1367 if (style.overflowX() == OSCROLL) 1368 style.setOverflowX(OHIDDEN); 1369 else if (style.overflowX() == OAUTO) 1370 style.setOverflowX(OVISIBLE); 1373 1371 1374 1372 // Only the root <svg> element in an SVG document fragment tree honors css position 1375 1373 if (!(e->hasTagName(SVGNames::svgTag) && e->parentNode() && !e->parentNode()->isSVGElement())) 1376 style ->setPosition(RenderStyle::initialPosition());1374 style.setPosition(RenderStyle::initialPosition()); 1377 1375 1378 1376 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignObject content should 1379 1377 // not be scaled again. 1380 1378 if (e->hasTagName(SVGNames::foreignObjectTag)) 1381 style ->setEffectiveZoom(RenderStyle::initialZoom());1382 } 1383 #endif 1384 } 1385 1386 void StyleResolver::adjustGridItemPosition(RenderStyle * style, RenderStyle*parentStyle) const1387 { 1388 const GridPosition& columnStartPosition = style ->gridItemColumnStart();1389 const GridPosition& columnEndPosition = style ->gridItemColumnEnd();1390 const GridPosition& rowStartPosition = style ->gridItemRowStart();1391 const GridPosition& rowEndPosition = style ->gridItemRowEnd();1379 style.setEffectiveZoom(RenderStyle::initialZoom()); 1380 } 1381 #endif 1382 } 1383 1384 void StyleResolver::adjustGridItemPosition(RenderStyle& style, const RenderStyle& parentStyle) const 1385 { 1386 const GridPosition& columnStartPosition = style.gridItemColumnStart(); 1387 const GridPosition& columnEndPosition = style.gridItemColumnEnd(); 1388 const GridPosition& rowStartPosition = style.gridItemRowStart(); 1389 const GridPosition& rowEndPosition = style.gridItemRowEnd(); 1392 1390 1393 1391 // If opposing grid-placement properties both specify a grid span, they both compute to ‘auto’. 1394 1392 if (columnStartPosition.isSpan() && columnEndPosition.isSpan()) { 1395 style ->setGridItemColumnStart(GridPosition());1396 style ->setGridItemColumnEnd(GridPosition());1393 style.setGridItemColumnStart(GridPosition()); 1394 style.setGridItemColumnEnd(GridPosition()); 1397 1395 } 1398 1396 1399 1397 if (rowStartPosition.isSpan() && rowEndPosition.isSpan()) { 1400 style ->setGridItemRowStart(GridPosition());1401 style ->setGridItemRowEnd(GridPosition());1398 style.setGridItemRowStart(GridPosition()); 1399 style.setGridItemRowEnd(GridPosition()); 1402 1400 } 1403 1401 1404 1402 // Unknown named grid area compute to 'auto'. 1405 const NamedGridAreaMap& map = parentStyle ->namedGridArea();1403 const NamedGridAreaMap& map = parentStyle.namedGridArea(); 1406 1404 1407 1405 #define CLEAR_UNKNOWN_NAMED_AREA(prop, Prop) \ 1408 1406 if (prop.isNamedGridArea() && !map.contains(prop.namedGridLine())) \ 1409 style ->setGridItem##Prop(GridPosition());1407 style.setGridItem##Prop(GridPosition()); 1410 1408 1411 1409 CLEAR_UNKNOWN_NAMED_AREA(columnStartPosition, ColumnStart); -
trunk/Source/WebCore/css/StyleResolver.h
r160528 r160539 346 346 #endif 347 347 348 void adjustRenderStyle(RenderStyle * styleToAdjust, RenderStyle*parentStyle, Element*);349 void adjustGridItemPosition(RenderStyle * styleToAdjust, RenderStyle*parentStyle) const;348 void adjustRenderStyle(RenderStyle& styleToAdjust, const RenderStyle& parentStyle, Element*); 349 void adjustGridItemPosition(RenderStyle& styleToAdjust, const RenderStyle& parentStyle) const; 350 350 351 351 bool fastRejectSelector(const RuleData&) const; -
trunk/Source/WebCore/page/FrameView.cpp
r160397 r160539 142 142 } 143 143 144 Pagination::Mode paginationModeForRenderStyle( RenderStyle*style)145 { 146 EOverflow overflow = style ->overflowY();144 Pagination::Mode paginationModeForRenderStyle(const RenderStyle& style) 145 { 146 EOverflow overflow = style.overflowY(); 147 147 if (overflow != OPAGEDX && overflow != OPAGEDY) 148 148 return Pagination::Unpaginated; 149 149 150 bool isHorizontalWritingMode = style ->isHorizontalWritingMode();151 TextDirection textDirection = style ->direction();152 WritingMode writingMode = style ->writingMode();150 bool isHorizontalWritingMode = style.isHorizontalWritingMode(); 151 TextDirection textDirection = style.direction(); 152 WritingMode writingMode = style.writingMode(); 153 153 154 154 // paged-x always corresponds to LeftToRightPaginated or RightToLeftPaginated. If the WritingMode … … 674 674 EOverflow overflowY = documentOrBodyRenderer->style().overflowY(); 675 675 if (overflowY == OPAGEDX || overflowY == OPAGEDY) { 676 pagination.mode = WebCore::paginationModeForRenderStyle( &documentOrBodyRenderer->style());676 pagination.mode = WebCore::paginationModeForRenderStyle(documentOrBodyRenderer->style()); 677 677 pagination.gap = static_cast<unsigned>(documentOrBodyRenderer->style().columnGap()); 678 678 } -
trunk/Source/WebCore/page/FrameView.h
r159300 r160539 59 59 class RenderWidget; 60 60 61 Pagination::Mode paginationModeForRenderStyle( RenderStyle*);61 Pagination::Mode paginationModeForRenderStyle(const RenderStyle&); 62 62 63 63 typedef unsigned long long DOMTimeStamp; -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r160236 r160539 81 81 } 82 82 83 void RenderTheme::adjustStyle(StyleResolver * styleResolver, RenderStyle*style, Element* e, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)83 void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, Element* e, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor) 84 84 { 85 85 // Force inline and table display styles to be inline-block (except for table- which is block) 86 ControlPart part = style ->appearance();87 if (style ->display() == INLINE || style->display() == INLINE_TABLE || style->display() == TABLE_ROW_GROUP88 || style ->display() == TABLE_HEADER_GROUP || style->display() == TABLE_FOOTER_GROUP89 || style ->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_COLUMN90 || style ->display() == TABLE_CELL || style->display() == TABLE_CAPTION)91 style ->setDisplay(INLINE_BLOCK);92 else if (style ->display() == COMPACT || style->display() == RUN_IN || style->display() == LIST_ITEM || style->display() == TABLE)93 style ->setDisplay(BLOCK);94 95 if (UAHasAppearance && isControlStyled( style, border, background, backgroundColor)) {86 ControlPart part = style.appearance(); 87 if (style.display() == INLINE || style.display() == INLINE_TABLE || style.display() == TABLE_ROW_GROUP 88 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOOTER_GROUP 89 || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP || style.display() == TABLE_COLUMN 90 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) 91 style.setDisplay(INLINE_BLOCK); 92 else if (style.display() == COMPACT || style.display() == RUN_IN || style.display() == LIST_ITEM || style.display() == TABLE) 93 style.setDisplay(BLOCK); 94 95 if (UAHasAppearance && isControlStyled(&style, border, background, backgroundColor)) { 96 96 if (part == MenulistPart) { 97 style ->setAppearance(MenulistButtonPart);97 style.setAppearance(MenulistButtonPart); 98 98 part = MenulistButtonPart; 99 99 } else 100 style ->setAppearance(NoControlPart);101 } 102 103 if (!style ->hasAppearance())100 style.setAppearance(NoControlPart); 101 } 102 103 if (!style.hasAppearance()) 104 104 return; 105 105 106 106 // Never support box-shadow on native controls. 107 style ->setBoxShadow(nullptr);107 style.setBoxShadow(nullptr); 108 108 109 109 #if USE(NEW_THEME) … … 117 117 case ButtonPart: { 118 118 // Border 119 LengthBox borderBox(style ->borderTopWidth(), style->borderRightWidth(), style->borderBottomWidth(), style->borderLeftWidth());120 borderBox = m_theme->controlBorder(part, style ->font(), borderBox, style->effectiveZoom());121 if (borderBox.top().value() != static_cast<int>(style ->borderTopWidth())) {119 LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth(), style.borderBottomWidth(), style.borderLeftWidth()); 120 borderBox = m_theme->controlBorder(part, style.font(), borderBox, style.effectiveZoom()); 121 if (borderBox.top().value() != static_cast<int>(style.borderTopWidth())) { 122 122 if (borderBox.top().value()) 123 style ->setBorderTopWidth(borderBox.top().value());123 style.setBorderTopWidth(borderBox.top().value()); 124 124 else 125 style ->resetBorderTop();125 style.resetBorderTop(); 126 126 } 127 if (borderBox.right().value() != static_cast<int>(style ->borderRightWidth())) {127 if (borderBox.right().value() != static_cast<int>(style.borderRightWidth())) { 128 128 if (borderBox.right().value()) 129 style ->setBorderRightWidth(borderBox.right().value());129 style.setBorderRightWidth(borderBox.right().value()); 130 130 else 131 style ->resetBorderRight();131 style.resetBorderRight(); 132 132 } 133 if (borderBox.bottom().value() != static_cast<int>(style ->borderBottomWidth())) {134 style ->setBorderBottomWidth(borderBox.bottom().value());133 if (borderBox.bottom().value() != static_cast<int>(style.borderBottomWidth())) { 134 style.setBorderBottomWidth(borderBox.bottom().value()); 135 135 if (borderBox.bottom().value()) 136 style ->setBorderBottomWidth(borderBox.bottom().value());136 style.setBorderBottomWidth(borderBox.bottom().value()); 137 137 else 138 style ->resetBorderBottom();138 style.resetBorderBottom(); 139 139 } 140 if (borderBox.left().value() != static_cast<int>(style ->borderLeftWidth())) {141 style ->setBorderLeftWidth(borderBox.left().value());140 if (borderBox.left().value() != static_cast<int>(style.borderLeftWidth())) { 141 style.setBorderLeftWidth(borderBox.left().value()); 142 142 if (borderBox.left().value()) 143 style ->setBorderLeftWidth(borderBox.left().value());143 style.setBorderLeftWidth(borderBox.left().value()); 144 144 else 145 style ->resetBorderLeft();145 style.resetBorderLeft(); 146 146 } 147 147 148 148 // Padding 149 LengthBox paddingBox = m_theme->controlPadding(part, style ->font(), style->paddingBox(), style->effectiveZoom());150 if (paddingBox != style ->paddingBox())151 style ->setPaddingBox(paddingBox);149 LengthBox paddingBox = m_theme->controlPadding(part, style.font(), style.paddingBox(), style.effectiveZoom()); 150 if (paddingBox != style.paddingBox()) 151 style.setPaddingBox(paddingBox); 152 152 153 153 // Whitespace 154 154 if (m_theme->controlRequiresPreWhiteSpace(part)) 155 style ->setWhiteSpace(PRE);155 style.setWhiteSpace(PRE); 156 156 157 157 // Width / Height 158 158 // The width and height here are affected by the zoom. 159 159 // FIXME: Check is flawed, since it doesn't take min-width/max-width into account. 160 LengthSize controlSize = m_theme->controlSize(part, style ->font(), LengthSize(style->width(), style->height()), style->effectiveZoom());161 if (controlSize.width() != style ->width())162 style ->setWidth(controlSize.width());163 if (controlSize.height() != style ->height())164 style ->setHeight(controlSize.height());160 LengthSize controlSize = m_theme->controlSize(part, style.font(), LengthSize(style.width(), style.height()), style.effectiveZoom()); 161 if (controlSize.width() != style.width()) 162 style.setWidth(controlSize.width()); 163 if (controlSize.height() != style.height()) 164 style.setHeight(controlSize.height()); 165 165 166 166 // Min-Width / Min-Height 167 LengthSize minControlSize = m_theme->minimumControlSize(part, style ->font(), style->effectiveZoom());168 if (minControlSize.width() != style ->minWidth())169 style ->setMinWidth(minControlSize.width());170 if (minControlSize.height() != style ->minHeight())171 style ->setMinHeight(minControlSize.height());167 LengthSize minControlSize = m_theme->minimumControlSize(part, style.font(), style.effectiveZoom()); 168 if (minControlSize.width() != style.minWidth()) 169 style.setMinWidth(minControlSize.width()); 170 if (minControlSize.height() != style.minHeight()) 171 style.setMinHeight(minControlSize.height()); 172 172 173 173 // Font 174 FontDescription controlFont = m_theme->controlFont(part, style ->font(), style->effectiveZoom());175 if (controlFont != style ->font().fontDescription()) {174 FontDescription controlFont = m_theme->controlFont(part, style.font(), style.effectiveZoom()); 175 if (controlFont != style.font().fontDescription()) { 176 176 // Reset our line-height 177 style ->setLineHeight(RenderStyle::initialLineHeight());177 style.setLineHeight(RenderStyle::initialLineHeight()); 178 178 179 179 // Now update our font. 180 if (style ->setFontDescription(controlFont))181 style ->font().update(0);180 if (style.setFontDescription(controlFont)) 181 style.font().update(0); 182 182 } 183 183 } … … 188 188 189 189 // Call the appropriate style adjustment method based off the appearance value. 190 switch (style ->appearance()) {190 switch (style.appearance()) { 191 191 #if !USE(NEW_THEME) 192 192 case CheckboxPart: 193 return adjustCheckboxStyle( styleResolver,style, e);193 return adjustCheckboxStyle(&styleResolver, &style, e); 194 194 case RadioPart: 195 return adjustRadioStyle( styleResolver,style, e);195 return adjustRadioStyle(&styleResolver, &style, e); 196 196 case PushButtonPart: 197 197 case SquareButtonPart: 198 198 case DefaultButtonPart: 199 199 case ButtonPart: 200 return adjustButtonStyle( styleResolver,style, e);200 return adjustButtonStyle(&styleResolver, &style, e); 201 201 case InnerSpinButtonPart: 202 return adjustInnerSpinButtonStyle( styleResolver,style, e);202 return adjustInnerSpinButtonStyle(&styleResolver, &style, e); 203 203 #endif 204 204 case TextFieldPart: 205 return adjustTextFieldStyle( styleResolver,style, e);205 return adjustTextFieldStyle(&styleResolver, &style, e); 206 206 case TextAreaPart: 207 return adjustTextAreaStyle( styleResolver,style, e);207 return adjustTextAreaStyle(&styleResolver, &style, e); 208 208 case MenulistPart: 209 return adjustMenuListStyle( styleResolver,style, e);209 return adjustMenuListStyle(&styleResolver, &style, e); 210 210 case MenulistButtonPart: 211 return adjustMenuListButtonStyle( styleResolver,style, e);211 return adjustMenuListButtonStyle(&styleResolver, &style, e); 212 212 case MediaPlayButtonPart: 213 213 case MediaCurrentTimePart: … … 217 217 case MediaMuteButtonPart: 218 218 case MediaVolumeSliderContainerPart: 219 return adjustMediaControlStyle( styleResolver,style, e);219 return adjustMediaControlStyle(&styleResolver, &style, e); 220 220 case MediaSliderPart: 221 221 case MediaVolumeSliderPart: … … 223 223 case SliderHorizontalPart: 224 224 case SliderVerticalPart: 225 return adjustSliderTrackStyle( styleResolver,style, e);225 return adjustSliderTrackStyle(&styleResolver, &style, e); 226 226 case SliderThumbHorizontalPart: 227 227 case SliderThumbVerticalPart: 228 return adjustSliderThumbStyle( styleResolver,style, e);228 return adjustSliderThumbStyle(&styleResolver, &style, e); 229 229 case SearchFieldPart: 230 return adjustSearchFieldStyle( styleResolver,style, e);230 return adjustSearchFieldStyle(&styleResolver, &style, e); 231 231 case SearchFieldCancelButtonPart: 232 return adjustSearchFieldCancelButtonStyle( styleResolver,style, e);232 return adjustSearchFieldCancelButtonStyle(&styleResolver, &style, e); 233 233 case SearchFieldDecorationPart: 234 return adjustSearchFieldDecorationPartStyle( styleResolver,style, e);234 return adjustSearchFieldDecorationPartStyle(&styleResolver, &style, e); 235 235 case SearchFieldResultsDecorationPart: 236 return adjustSearchFieldResultsDecorationPartStyle( styleResolver,style, e);236 return adjustSearchFieldResultsDecorationPartStyle(&styleResolver, &style, e); 237 237 case SearchFieldResultsButtonPart: 238 return adjustSearchFieldResultsButtonStyle( styleResolver,style, e);238 return adjustSearchFieldResultsButtonStyle(&styleResolver, &style, e); 239 239 #if ENABLE(PROGRESS_ELEMENT) 240 240 case ProgressBarPart: 241 return adjustProgressBarStyle( styleResolver,style, e);241 return adjustProgressBarStyle(&styleResolver, &style, e); 242 242 #endif 243 243 #if ENABLE(METER_ELEMENT) … … 247 247 case DiscreteCapacityLevelIndicatorPart: 248 248 case RatingLevelIndicatorPart: 249 return adjustMeterStyle( styleResolver,style, e);249 return adjustMeterStyle(&styleResolver, &style, e); 250 250 #endif 251 251 #if ENABLE(INPUT_SPEECH) 252 252 case InputSpeechButtonPart: 253 return adjustInputFieldSpeechButtonStyle( styleResolver,style, e);253 return adjustInputFieldSpeechButtonStyle(&styleResolver, &style, e); 254 254 #endif 255 255 default: -
trunk/Source/WebCore/rendering/RenderTheme.h
r160236 r160539 74 74 // selection of control size based off the font, the disabling of appearance when certain other properties like 75 75 // "border" are set, or if the appearance is not supported by the theme. 76 void adjustStyle(StyleResolver*, RenderStyle*, Element*, bool UAHasAppearance, 77 const BorderData&, const FillLayer&, const Color& backgroundColor); 76 void adjustStyle(StyleResolver&, RenderStyle&, Element*, bool UAHasAppearance, const BorderData&, const FillLayer&, const Color& backgroundColor); 78 77 79 78 // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the
Note: See TracChangeset
for help on using the changeset viewer.