OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
6 * All rights reserved. | 6 * 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. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // This is necessary to fix a crash where a site tries to position these | 223 // This is necessary to fix a crash where a site tries to position these |
224 // objects. They also never honor display. | 224 // objects. They also never honor display. |
225 style.setPosition(StaticPosition); | 225 style.setPosition(StaticPosition); |
226 style.setDisplay(EDisplay::Block); | 226 style.setDisplay(EDisplay::Block); |
227 return; | 227 return; |
228 } | 228 } |
229 | 229 |
230 if (isHTMLFrameElementBase(element)) { | 230 if (isHTMLFrameElementBase(element)) { |
231 // Frames cannot overflow (they are always the size we ask them to be). | 231 // Frames cannot overflow (they are always the size we ask them to be). |
232 // Some compositing code paths may try to draw scrollbars anyhow. | 232 // Some compositing code paths may try to draw scrollbars anyhow. |
233 style.setOverflowX(OverflowVisible); | 233 style.setOverflowX(EOverflow::Visible); |
234 style.setOverflowY(OverflowVisible); | 234 style.setOverflowY(EOverflow::Visible); |
235 return; | 235 return; |
236 } | 236 } |
237 | 237 |
238 if (isHTMLRTElement(element)) { | 238 if (isHTMLRTElement(element)) { |
239 // Ruby text does not support float or position. This might change with | 239 // Ruby text does not support float or position. This might change with |
240 // evolution of the specification. | 240 // evolution of the specification. |
241 style.setPosition(StaticPosition); | 241 style.setPosition(StaticPosition); |
242 style.setFloating(EFloat::None); | 242 style.setFloating(EFloat::None); |
243 return; | 243 return; |
244 } | 244 } |
245 | 245 |
246 if (isHTMLLegendElement(element)) { | 246 if (isHTMLLegendElement(element)) { |
247 style.setDisplay(EDisplay::Block); | 247 style.setDisplay(EDisplay::Block); |
248 return; | 248 return; |
249 } | 249 } |
250 | 250 |
251 if (isHTMLMarqueeElement(element)) { | 251 if (isHTMLMarqueeElement(element)) { |
252 // For now, <marquee> requires an overflow clip to work properly. | 252 // For now, <marquee> requires an overflow clip to work properly. |
253 style.setOverflowX(OverflowHidden); | 253 style.setOverflowX(EOverflow::Hidden); |
254 style.setOverflowY(OverflowHidden); | 254 style.setOverflowY(EOverflow::Hidden); |
255 return; | 255 return; |
256 } | 256 } |
257 | 257 |
258 if (isHTMLTextAreaElement(element)) { | 258 if (isHTMLTextAreaElement(element)) { |
259 // Textarea considers overflow visible as auto. | 259 // Textarea considers overflow visible as auto. |
260 style.setOverflowX(style.overflowX() == OverflowVisible | 260 style.setOverflowX(style.overflowX() == EOverflow::Visible |
261 ? OverflowAuto | 261 ? EOverflow::Auto |
262 : style.overflowX()); | 262 : style.overflowX()); |
263 style.setOverflowY(style.overflowY() == OverflowVisible | 263 style.setOverflowY(style.overflowY() == EOverflow::Visible |
264 ? OverflowAuto | 264 ? EOverflow::Auto |
265 : style.overflowY()); | 265 : style.overflowY()); |
266 return; | 266 return; |
267 } | 267 } |
268 | 268 |
269 if (isHTMLPlugInElement(element)) { | 269 if (isHTMLPlugInElement(element)) { |
270 style.setRequiresAcceleratedCompositingForExternalReasons( | 270 style.setRequiresAcceleratedCompositingForExternalReasons( |
271 toHTMLPlugInElement(element).shouldAccelerate()); | 271 toHTMLPlugInElement(element).shouldAccelerate()); |
272 return; | 272 return; |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 static void adjustOverflow(ComputedStyle& style) { | 276 static void adjustOverflow(ComputedStyle& style) { |
277 ASSERT(style.overflowX() != OverflowVisible || | 277 DCHECK(style.overflowX() != EOverflow::Visible || |
278 style.overflowY() != OverflowVisible); | 278 style.overflowY() != EOverflow::Visible); |
279 | 279 |
280 if (style.display() == EDisplay::Table || | 280 if (style.display() == EDisplay::Table || |
281 style.display() == EDisplay::InlineTable) { | 281 style.display() == EDisplay::InlineTable) { |
282 // Tables only support overflow:hidden and overflow:visible and ignore | 282 // Tables only support overflow:hidden and overflow:visible and ignore |
283 // anything else, see http://dev.w3.org/csswg/css2/visufx.html#overflow. As | 283 // anything else, see http://dev.w3.org/csswg/css2/visufx.html#overflow. As |
284 // a table is not a block container box the rules for resolving conflicting | 284 // a table is not a block container box the rules for resolving conflicting |
285 // x and y values in CSS Overflow Module Level 3 do not apply. Arguably | 285 // x and y values in CSS Overflow Module Level 3 do not apply. Arguably |
286 // overflow-x and overflow-y aren't allowed on tables but all UAs allow it. | 286 // overflow-x and overflow-y aren't allowed on tables but all UAs allow it. |
287 if (style.overflowX() != OverflowHidden) | 287 if (style.overflowX() != EOverflow::Hidden) |
288 style.setOverflowX(OverflowVisible); | 288 style.setOverflowX(EOverflow::Visible); |
289 if (style.overflowY() != OverflowHidden) | 289 if (style.overflowY() != EOverflow::Hidden) |
290 style.setOverflowY(OverflowVisible); | 290 style.setOverflowY(EOverflow::Visible); |
291 // If we are left with conflicting overflow values for the x and y axes on a | 291 // If we are left with conflicting overflow values for the x and y axes on a |
292 // table then resolve both to OverflowVisible. This is interoperable | 292 // table then resolve both to OverflowVisible. This is interoperable |
293 // behaviour but is not specced anywhere. | 293 // behaviour but is not specced anywhere. |
294 if (style.overflowX() == OverflowVisible) | 294 if (style.overflowX() == EOverflow::Visible) |
295 style.setOverflowY(OverflowVisible); | 295 style.setOverflowY(EOverflow::Visible); |
296 else if (style.overflowY() == OverflowVisible) | 296 else if (style.overflowY() == EOverflow::Visible) |
297 style.setOverflowX(OverflowVisible); | 297 style.setOverflowX(EOverflow::Visible); |
298 } else if (style.overflowX() == OverflowVisible && | 298 } else if (style.overflowX() == EOverflow::Visible && |
299 style.overflowY() != OverflowVisible) { | 299 style.overflowY() != EOverflow::Visible) { |
300 // If either overflow value is not visible, change to auto. | 300 // If either overflow value is not visible, change to auto. |
301 // FIXME: Once we implement pagination controls, overflow-x should default | 301 // FIXME: Once we implement pagination controls, overflow-x should default |
302 // to hidden if overflow-y is set to -webkit-paged-x or -webkit-page-y. For | 302 // to hidden if overflow-y is set to -webkit-paged-x or -webkit-page-y. For |
303 // now, we'll let it default to auto so we can at least scroll through the | 303 // now, we'll let it default to auto so we can at least scroll through the |
304 // pages. | 304 // pages. |
305 style.setOverflowX(OverflowAuto); | 305 style.setOverflowX(EOverflow::Auto); |
306 } else if (style.overflowY() == OverflowVisible && | 306 } else if (style.overflowY() == EOverflow::Visible && |
307 style.overflowX() != OverflowVisible) { | 307 style.overflowX() != EOverflow::Visible) { |
308 style.setOverflowY(OverflowAuto); | 308 style.setOverflowY(EOverflow::Auto); |
309 } | 309 } |
310 | 310 |
311 // Menulists should have visible overflow | 311 // Menulists should have visible overflow |
312 if (style.appearance() == MenulistPart) { | 312 if (style.appearance() == MenulistPart) { |
313 style.setOverflowX(OverflowVisible); | 313 style.setOverflowX(EOverflow::Visible); |
314 style.setOverflowY(OverflowVisible); | 314 style.setOverflowY(EOverflow::Visible); |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 static void adjustStyleForDisplay(ComputedStyle& style, | 318 static void adjustStyleForDisplay(ComputedStyle& style, |
319 const ComputedStyle& parentStyle, | 319 const ComputedStyle& parentStyle, |
320 Document* document) { | 320 Document* document) { |
321 if (style.display() == EDisplay::Block && !style.isFloating()) | 321 if (style.display() == EDisplay::Block && !style.isFloating()) |
322 return; | 322 return; |
323 | 323 |
324 // FIXME: Don't support this mutation for pseudo styles like first-letter or | 324 // FIXME: Don't support this mutation for pseudo styles like first-letter or |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (style.position() == StaticPosition && | 426 if (style.position() == StaticPosition && |
427 !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) { | 427 !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) { |
428 style.setIsStackingContext(false); | 428 style.setIsStackingContext(false); |
429 // TODO(alancutter): Avoid altering z-index here. | 429 // TODO(alancutter): Avoid altering z-index here. |
430 if (!style.hasAutoZIndex()) | 430 if (!style.hasAutoZIndex()) |
431 style.setZIndex(0); | 431 style.setZIndex(0); |
432 } else if (!style.hasAutoZIndex()) { | 432 } else if (!style.hasAutoZIndex()) { |
433 style.setIsStackingContext(true); | 433 style.setIsStackingContext(true); |
434 } | 434 } |
435 | 435 |
436 if (style.overflowX() != OverflowVisible || | 436 if (style.overflowX() != EOverflow::Visible || |
437 style.overflowY() != OverflowVisible) | 437 style.overflowY() != EOverflow::Visible) |
438 adjustOverflow(style); | 438 adjustOverflow(style); |
439 | 439 |
440 if (doesNotInheritTextDecoration(style, element)) | 440 if (doesNotInheritTextDecoration(style, element)) |
441 style.clearAppliedTextDecorations(); | 441 style.clearAppliedTextDecorations(); |
442 else | 442 else |
443 style.restoreParentTextDecorations(parentStyle); | 443 style.restoreParentTextDecorations(parentStyle); |
444 style.applyTextDecorations( | 444 style.applyTextDecorations( |
445 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor), | 445 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor), |
446 overridesTextDecorationColors(element)); | 446 overridesTextDecorationColors(element)); |
447 | 447 |
(...skipping 28 matching lines...) Expand all Loading... |
476 style.setDisplay(EDisplay::Block); | 476 style.setDisplay(EDisplay::Block); |
477 | 477 |
478 // Columns don't apply to svg text elements. | 478 // Columns don't apply to svg text elements. |
479 if (isSVGTextElement(*element)) | 479 if (isSVGTextElement(*element)) |
480 style.clearMultiCol(); | 480 style.clearMultiCol(); |
481 } | 481 } |
482 adjustStyleForAlignment(style, parentStyle); | 482 adjustStyleForAlignment(style, parentStyle); |
483 } | 483 } |
484 | 484 |
485 } // namespace blink | 485 } // namespace blink |
OLD | NEW |