OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 bool RenderStyle::inheritedDataShared(const RenderStyle* other) const | 347 bool RenderStyle::inheritedDataShared(const RenderStyle* other) const |
348 { | 348 { |
349 // This is a fast check that only looks if the data structures are shared. | 349 // This is a fast check that only looks if the data structures are shared. |
350 return inherited_flags == other->inherited_flags | 350 return inherited_flags == other->inherited_flags |
351 && inherited.get() == other->inherited.get() | 351 && inherited.get() == other->inherited.get() |
352 && m_svgStyle.get() == other->m_svgStyle.get() | 352 && m_svgStyle.get() == other->m_svgStyle.get() |
353 && rareInheritedData.get() == other->rareInheritedData.get(); | 353 && rareInheritedData.get() == other->rareInheritedData.get(); |
354 } | 354 } |
355 | 355 |
356 static bool positionedObjectMovedOnly(const LengthBox& a, const LengthBox& b, co
nst Length& width) | |
357 { | |
358 // If any unit types are different, then we can't guarantee | |
359 // that this was just a movement. | |
360 if (a.left().type() != b.left().type() | |
361 || a.right().type() != b.right().type() | |
362 || a.top().type() != b.top().type() | |
363 || a.bottom().type() != b.bottom().type()) | |
364 return false; | |
365 | |
366 // Only one unit can be non-auto in the horizontal direction and | |
367 // in the vertical direction. Otherwise the adjustment of values | |
368 // is changing the size of the box. | |
369 if (!a.left().isIntrinsicOrAuto() && !a.right().isIntrinsicOrAuto()) | |
370 return false; | |
371 if (!a.top().isIntrinsicOrAuto() && !a.bottom().isIntrinsicOrAuto()) | |
372 return false; | |
373 // If our width is auto and left or right is specified and changed then this | |
374 // is not just a movement - we need to resize to our container. | |
375 if (width.isIntrinsicOrAuto() | |
376 && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left()) | |
377 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) | |
378 return false; | |
379 | |
380 // One of the units is fixed or percent in both directions and stayed | |
381 // that way in the new style. Therefore all we are doing is moving. | |
382 return true; | |
383 } | |
384 | |
385 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
nst | 356 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
nst |
386 { | 357 { |
387 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep | 358 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep |
388 // compare, which is duplicate work when we're going to compare each propert
y inside | 359 // compare, which is duplicate work when we're going to compare each propert
y inside |
389 // this function anyway. | 360 // this function anyway. |
390 | 361 |
391 StyleDifference diff; | 362 StyleDifference diff; |
392 if (m_svgStyle.get() != other.m_svgStyle.get()) | 363 if (m_svgStyle.get() != other.m_svgStyle.get()) |
393 diff = m_svgStyle->diff(other.m_svgStyle.get()); | 364 diff = m_svgStyle->diff(other.m_svgStyle.get()); |
394 | 365 |
395 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && diffNeeds
FullLayoutAndPaintInvalidation(other)) { | 366 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && diffNeeds
FullLayoutAndPaintInvalidation(other)) { |
396 diff.setNeedsFullLayout(); | 367 diff.setNeedsFullLayout(); |
397 diff.setNeedsPaintInvalidationObject(); | 368 diff.setNeedsPaintInvalidationObject(); |
398 } | 369 } |
399 | 370 |
400 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) | 371 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) |
401 diff.setNeedsFullLayout(); | 372 diff.setNeedsFullLayout(); |
402 | 373 |
403 if (!diff.needsFullLayout() && surround->margin != other.surround->margin) { | 374 if (!diff.needsFullLayout() && surround->margin != other.surround->margin) { |
404 // Relative-positioned elements collapse their margins so need a full la
yout. | 375 // Relative-positioned elements collapse their margins so need a full la
yout. |
405 if (position() == AbsolutePosition || position() == FixedPosition) | 376 if (position() == AbsolutePosition || position() == FixedPosition) |
406 diff.setNeedsPositionedMovementLayout(); | 377 diff.setNeedsPositionedMovementLayout(); |
407 else | 378 else |
408 diff.setNeedsFullLayout(); | 379 diff.setNeedsFullLayout(); |
409 } | 380 } |
410 | 381 |
411 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { | 382 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { |
412 // Optimize for the case where a positioned layer is moving but not chan
ging size. | 383 // Optimize for the case where a positioned layer is moving but not chan
ging size. |
413 if (positionedObjectMovedOnly(surround->offset, other.surround->offset,
m_box->width())) | 384 diff.setNeedsPositionedMovementLayout(); |
414 diff.setNeedsPositionedMovementLayout(); | |
415 else | |
416 diff.setNeedsFullLayout(); | |
417 } | 385 } |
418 | 386 |
419 if (diffNeedsPaintInvalidationLayer(other)) | 387 if (diffNeedsPaintInvalidationLayer(other)) |
420 diff.setNeedsPaintInvalidationLayer(); | 388 diff.setNeedsPaintInvalidationLayer(); |
421 else if (diffNeedsPaintInvalidationObject(other)) | 389 else if (diffNeedsPaintInvalidationObject(other)) |
422 diff.setNeedsPaintInvalidationObject(); | 390 diff.setNeedsPaintInvalidationObject(); |
423 | 391 |
424 updatePropertySpecificDifferences(other, diff); | 392 updatePropertySpecificDifferences(other, diff); |
425 | 393 |
426 // Cursors are not checked, since they will be set appropriately in response
to mouse events, | 394 // Cursors are not checked, since they will be set appropriately in response
to mouse events, |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 horizontal || includeLogicalRightEdge); | 1678 horizontal || includeLogicalRightEdge); |
1711 | 1679 |
1712 edges[BSLeft] = BorderEdge(borderLeftWidth(), | 1680 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
1713 visitedDependentColor(CSSPropertyBorderLeftColor), | 1681 visitedDependentColor(CSSPropertyBorderLeftColor), |
1714 borderLeftStyle(), | 1682 borderLeftStyle(), |
1715 borderLeftIsTransparent(), | 1683 borderLeftIsTransparent(), |
1716 !horizontal || includeLogicalLeftEdge); | 1684 !horizontal || includeLogicalLeftEdge); |
1717 } | 1685 } |
1718 | 1686 |
1719 } // namespace blink | 1687 } // namespace blink |
OLD | NEW |