|
Lines 2376-2382
void RuleSet::shrinkToFit()
Source/WebCore/css/CSSStyleSelector.cpp_sec1
|
| 2376 |
// ------------------------------------------------------------------------------------- |
2376 |
// ------------------------------------------------------------------------------------- |
| 2377 |
// this is mostly boring stuff on how to apply a certain rule to the renderstyle... |
2377 |
// this is mostly boring stuff on how to apply a certain rule to the renderstyle... |
| 2378 |
|
2378 |
|
| 2379 |
static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, bool toFloat, double multiplier = 1, bool *ok = 0) |
2379 |
static Length convertToLength(CSSPrimitiveValue* primitiveValue, CSSStyleSelector* styleSelector, bool toFloat, double multiplier = 1, bool *ok = 0) |
| 2380 |
{ |
2380 |
{ |
| 2381 |
// This function is tolerant of a null style value. The only place style is used is in |
2381 |
// This function is tolerant of a null style value. The only place style is used is in |
| 2382 |
// length measurements, like 'ems' and 'px'. And in those cases style is only used |
2382 |
// length measurements, like 'ems' and 'px'. And in those cases style is only used |
|
Lines 2386-2417
static Length convertToLength(CSSPrimiti
Source/WebCore/css/CSSStyleSelector.cpp_sec2
|
| 2386 |
if (ok) |
2386 |
if (ok) |
| 2387 |
*ok = false; |
2387 |
*ok = false; |
| 2388 |
} else { |
2388 |
} else { |
| 2389 |
if (!style && primitiveValue->isFontRelativeLength()) { |
2389 |
if (!styleSelector->style() && primitiveValue->isFontRelativeLength()) { |
| 2390 |
if (ok) |
2390 |
if (ok) |
| 2391 |
*ok = false; |
2391 |
*ok = false; |
| 2392 |
} else if (primitiveValue->isLength()) { |
2392 |
} else if (primitiveValue->isLength()) { |
| 2393 |
if (toFloat) |
2393 |
if (toFloat) |
| 2394 |
l = Length(primitiveValue->computeLength<double>(style, rootStyle, multiplier), Fixed); |
2394 |
l = Length(primitiveValue->computeLength<double>(styleSelector->style(), styleSelector->rootElementStyle(), multiplier), Fixed); |
| 2395 |
else |
2395 |
else |
| 2396 |
l = primitiveValue->computeLength<Length>(style, rootStyle, multiplier); |
2396 |
l = primitiveValue->computeLength<Length>(styleSelector->style(), styleSelector->rootElementStyle(), multiplier); |
| 2397 |
} else if (primitiveValue->isPercentage()) |
2397 |
} else if (primitiveValue->isPercentage()) |
| 2398 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
2398 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
| 2399 |
else if (primitiveValue->isNumber()) |
2399 |
else if (primitiveValue->isNumber()) |
| 2400 |
l = Length(primitiveValue->getDoubleValue() * 100.0, Percent); |
2400 |
l = Length(primitiveValue->getDoubleValue() * 100.0, Percent); |
|
|
2401 |
else if (primitiveValue->isRelativeViewportLength()) |
| 2402 |
l = RelativeviewportLength(primitiveValue, styleSelector->document()); |
| 2401 |
else if (ok) |
2403 |
else if (ok) |
| 2402 |
*ok = false; |
2404 |
*ok = false; |
| 2403 |
} |
2405 |
} |
| 2404 |
return l; |
2406 |
return l; |
| 2405 |
} |
2407 |
} |
| 2406 |
|
2408 |
|
| 2407 |
static Length convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0) |
2409 |
static Length convertToIntLength(CSSPrimitiveValue* primitiveValue, CSSStyleSelector* styleSelector, double multiplier = 1, bool *ok = 0) |
| 2408 |
{ |
2410 |
{ |
| 2409 |
return convertToLength(primitiveValue, style, rootStyle, false, multiplier, ok); |
2411 |
return convertToLength(primitiveValue, styleSelector, false, multiplier, ok); |
| 2410 |
} |
2412 |
} |
| 2411 |
|
2413 |
|
| 2412 |
static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0) |
2414 |
static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, CSSStyleSelector* styleSelector, double multiplier = 1, bool *ok = 0) |
| 2413 |
{ |
2415 |
{ |
| 2414 |
return convertToLength(primitiveValue, style, rootStyle, true, multiplier, ok); |
2416 |
return convertToLength(primitiveValue, styleSelector, true, multiplier, ok); |
| 2415 |
} |
2417 |
} |
| 2416 |
|
2418 |
|
| 2417 |
static inline bool isInsideRegionRule(StylePropertySet* styleDeclaration) |
2419 |
static inline bool isInsideRegionRule(StylePropertySet* styleDeclaration) |
|
Lines 2823-2828
static bool createGridTrackBreadth(CSSPr
Source/WebCore/css/CSSStyleSelector.cpp_sec3
|
| 2823 |
length = Length(primitiveValue->getDoubleValue(), Percent); |
2825 |
length = Length(primitiveValue->getDoubleValue(), Percent); |
| 2824 |
return true; |
2826 |
return true; |
| 2825 |
} |
2827 |
} |
|
|
2828 |
|
| 2829 |
if (primitiveValue->isRelativeViewportLength()) { |
| 2830 |
length = RelativeviewportLength(primitiveValue, selector->document()); |
| 2831 |
return true; |
| 2832 |
} |
| 2826 |
|
2833 |
|
| 2827 |
return false; |
2834 |
return false; |
| 2828 |
} |
2835 |
} |
|
Lines 3464-3470
void CSSStyleSelector::applyProperty(int
Source/WebCore/css/CSSStyleSelector.cpp_sec4
|
| 3464 |
} |
3471 |
} |
| 3465 |
} else { |
3472 |
} else { |
| 3466 |
bool ok = true; |
3473 |
bool ok = true; |
| 3467 |
Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle, 1, &ok); |
3474 |
Length marqueeLength = convertToIntLength(primitiveValue, this, 1, &ok); |
| 3468 |
if (ok) |
3475 |
if (ok) |
| 3469 |
m_style->setMarqueeIncrement(marqueeLength); |
3476 |
m_style->setMarqueeIncrement(marqueeLength); |
| 3470 |
} |
3477 |
} |
|
Lines 3550-3559
void CSSStyleSelector::applyProperty(int
Source/WebCore/css/CSSStyleSelector.cpp_sec5
|
| 3550 |
|
3557 |
|
| 3551 |
DashboardRegion *first = region; |
3558 |
DashboardRegion *first = region; |
| 3552 |
while (region) { |
3559 |
while (region) { |
| 3553 |
Length top = convertToIntLength(region->top(), style(), m_rootElementStyle); |
3560 |
Length top = convertToIntLength(region->top(), this); |
| 3554 |
Length right = convertToIntLength(region->right(), style(), m_rootElementStyle); |
3561 |
Length right = convertToIntLength(region->right(), this); |
| 3555 |
Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle); |
3562 |
Length bottom = convertToIntLength(region->bottom(), this); |
| 3556 |
Length left = convertToIntLength(region->left(), style(), m_rootElementStyle); |
3563 |
Length left = convertToIntLength(region->left(), this); |
| 3557 |
if (region->m_isCircle) |
3564 |
if (region->m_isCircle) |
| 3558 |
m_style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true); |
3565 |
m_style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true); |
| 3559 |
else if (region->m_isRectangle) |
3566 |
else if (region->m_isRectangle) |
|
Lines 3594-3600
void CSSStyleSelector::applyProperty(int
Source/WebCore/css/CSSStyleSelector.cpp_sec6
|
| 3594 |
case CSSPropertyWebkitTransform: { |
3601 |
case CSSPropertyWebkitTransform: { |
| 3595 |
HANDLE_INHERIT_AND_INITIAL(transform, Transform); |
3602 |
HANDLE_INHERIT_AND_INITIAL(transform, Transform); |
| 3596 |
TransformOperations operations; |
3603 |
TransformOperations operations; |
| 3597 |
createTransformOperations(value, style(), m_rootElementStyle, operations); |
3604 |
createTransformOperations(value, this, operations); |
| 3598 |
m_style->setTransform(operations); |
3605 |
m_style->setTransform(operations); |
| 3599 |
return; |
3606 |
return; |
| 3600 |
} |
3607 |
} |
|
Lines 4198-4203
void CSSStyleSelector::mapFillSize(CSSPr
Source/WebCore/css/CSSStyleSelector.cpp_sec7
|
| 4198 |
firstLength = first->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
4205 |
firstLength = first->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
| 4199 |
else if (first->isPercentage()) |
4206 |
else if (first->isPercentage()) |
| 4200 |
firstLength = Length(first->getDoubleValue(), Percent); |
4207 |
firstLength = Length(first->getDoubleValue(), Percent); |
|
|
4208 |
else if (first->isRelativeViewportLength()) |
| 4209 |
firstLength = RelativeviewportLength(first, document()); |
| 4201 |
else |
4210 |
else |
| 4202 |
return; |
4211 |
return; |
| 4203 |
|
4212 |
|
|
Lines 4207-4212
void CSSStyleSelector::mapFillSize(CSSPr
Source/WebCore/css/CSSStyleSelector.cpp_sec8
|
| 4207 |
secondLength = second->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
4216 |
secondLength = second->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
| 4208 |
else if (second->isPercentage()) |
4217 |
else if (second->isPercentage()) |
| 4209 |
secondLength = Length(second->getDoubleValue(), Percent); |
4218 |
secondLength = Length(second->getDoubleValue(), Percent); |
|
|
4219 |
else if (second->isRelativeViewportLength()) |
| 4220 |
secondLength = RelativeviewportLength(second, document()); |
| 4210 |
else |
4221 |
else |
| 4211 |
return; |
4222 |
return; |
| 4212 |
|
4223 |
|
|
Lines 4233-4238
void CSSStyleSelector::mapFillXPosition(
Source/WebCore/css/CSSStyleSelector.cpp_sec9
|
| 4233 |
l = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
4244 |
l = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
| 4234 |
else if (primitiveValue->isPercentage()) |
4245 |
else if (primitiveValue->isPercentage()) |
| 4235 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
4246 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
|
|
4247 |
else if (primitiveValue->isRelativeViewportLength()) |
| 4248 |
l = RelativeviewportLength(primitiveValue, document()); |
| 4236 |
else |
4249 |
else |
| 4237 |
return; |
4250 |
return; |
| 4238 |
layer->setXPosition(l); |
4251 |
layer->setXPosition(l); |
|
Lines 4256-4261
void CSSStyleSelector::mapFillYPosition(
Source/WebCore/css/CSSStyleSelector.cpp_sec10
|
| 4256 |
l = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
4269 |
l = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); |
| 4257 |
else if (primitiveValue->isPercentage()) |
4270 |
else if (primitiveValue->isPercentage()) |
| 4258 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
4271 |
l = Length(primitiveValue->getDoubleValue(), Percent); |
|
|
4272 |
else if (primitiveValue->isRelativeViewportLength()) |
| 4273 |
l = RelativeviewportLength(primitiveValue, document()); |
| 4259 |
else |
4274 |
else |
| 4260 |
return; |
4275 |
return; |
| 4261 |
layer->setYPosition(l); |
4276 |
layer->setYPosition(l); |
|
Lines 4950-4962
static TransformOperation::OperationType
Source/WebCore/css/CSSStyleSelector.cpp_sec11
|
| 4950 |
return TransformOperation::NONE; |
4965 |
return TransformOperation::NONE; |
| 4951 |
} |
4966 |
} |
| 4952 |
|
4967 |
|
| 4953 |
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations) |
4968 |
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, CSSStyleSelector* styleSelector, TransformOperations& outOperations) |
| 4954 |
{ |
4969 |
{ |
| 4955 |
if (!inValue || !inValue->isValueList()) { |
4970 |
if (!inValue || !inValue->isValueList()) { |
| 4956 |
outOperations.clear(); |
4971 |
outOperations.clear(); |
| 4957 |
return false; |
4972 |
return false; |
| 4958 |
} |
4973 |
} |
| 4959 |
|
4974 |
|
|
|
4975 |
RenderStyle* style = styleSelector ? styleSelector->style() : 0; |
| 4960 |
float zoomFactor = style ? style->effectiveZoom() : 1; |
4976 |
float zoomFactor = style ? style->effectiveZoom() : 1; |
| 4961 |
TransformOperations operations; |
4977 |
TransformOperations operations; |
| 4962 |
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) { |
4978 |
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) { |
|
Lines 5034-5046
bool CSSStyleSelector::createTransformOp
Source/WebCore/css/CSSStyleSelector.cpp_sec12
|
| 5034 |
Length tx = Length(0, Fixed); |
5050 |
Length tx = Length(0, Fixed); |
| 5035 |
Length ty = Length(0, Fixed); |
5051 |
Length ty = Length(0, Fixed); |
| 5036 |
if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) |
5052 |
if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) |
| 5037 |
ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5053 |
ty = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5038 |
else { |
5054 |
else { |
| 5039 |
tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5055 |
tx = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5040 |
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { |
5056 |
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { |
| 5041 |
if (transformValue->length() > 1) { |
5057 |
if (transformValue->length() > 1) { |
| 5042 |
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); |
5058 |
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); |
| 5043 |
ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor, &ok); |
5059 |
ty = convertToFloatLength(secondValue, styleSelector, zoomFactor, &ok); |
| 5044 |
} |
5060 |
} |
| 5045 |
} |
5061 |
} |
| 5046 |
} |
5062 |
} |
|
Lines 5058-5076
bool CSSStyleSelector::createTransformOp
Source/WebCore/css/CSSStyleSelector.cpp_sec13
|
| 5058 |
Length ty = Length(0, Fixed); |
5074 |
Length ty = Length(0, Fixed); |
| 5059 |
Length tz = Length(0, Fixed); |
5075 |
Length tz = Length(0, Fixed); |
| 5060 |
if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation) |
5076 |
if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation) |
| 5061 |
tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5077 |
tz = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5062 |
else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) |
5078 |
else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) |
| 5063 |
ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5079 |
ty = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5064 |
else { |
5080 |
else { |
| 5065 |
tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5081 |
tx = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5066 |
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { |
5082 |
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { |
| 5067 |
if (transformValue->length() > 2) { |
5083 |
if (transformValue->length() > 2) { |
| 5068 |
CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2)); |
5084 |
CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2)); |
| 5069 |
tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor, &ok); |
5085 |
tz = convertToFloatLength(thirdValue, styleSelector, zoomFactor, &ok); |
| 5070 |
} |
5086 |
} |
| 5071 |
if (transformValue->length() > 1) { |
5087 |
if (transformValue->length() > 1) { |
| 5072 |
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); |
5088 |
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); |
| 5073 |
ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor, &ok); |
5089 |
ty = convertToFloatLength(secondValue, styleSelector, zoomFactor, &ok); |
| 5074 |
} |
5090 |
} |
| 5075 |
} |
5091 |
} |
| 5076 |
} |
5092 |
} |
|
Lines 5174-5180
bool CSSStyleSelector::createTransformOp
Source/WebCore/css/CSSStyleSelector.cpp_sec14
|
| 5174 |
bool ok = true; |
5190 |
bool ok = true; |
| 5175 |
Length p = Length(0, Fixed); |
5191 |
Length p = Length(0, Fixed); |
| 5176 |
if (firstValue->isLength()) |
5192 |
if (firstValue->isLength()) |
| 5177 |
p = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5193 |
p = convertToFloatLength(firstValue, styleSelector, zoomFactor, &ok); |
| 5178 |
else { |
5194 |
else { |
| 5179 |
// This is a quirk that should go away when 3d transforms are finalized. |
5195 |
// This is a quirk that should go away when 3d transforms are finalized. |
| 5180 |
double val = firstValue->getDoubleValue(); |
5196 |
double val = firstValue->getDoubleValue(); |
|
Lines 5531-5537
bool CSSStyleSelector::createFilterOpera
Source/WebCore/css/CSSStyleSelector.cpp_sec15
|
| 5531 |
bool ok = true; |
5547 |
bool ok = true; |
| 5532 |
Length stdDeviation = Length(0, Fixed); |
5548 |
Length stdDeviation = Length(0, Fixed); |
| 5533 |
if (filterValue->length() >= 1) { |
5549 |
if (filterValue->length() >= 1) { |
| 5534 |
stdDeviation = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); |
5550 |
stdDeviation = convertToFloatLength(firstValue, this, zoomFactor, &ok); |
| 5535 |
} |
5551 |
} |
| 5536 |
if (!ok) |
5552 |
if (!ok) |
| 5537 |
return false; |
5553 |
return false; |
|
Lines 5671-5674
void CSSStyleSelector::loadPendingImages
Source/WebCore/css/CSSStyleSelector.cpp_sec16
|
| 5671 |
m_pendingImageProperties.clear(); |
5687 |
m_pendingImageProperties.clear(); |
| 5672 |
} |
5688 |
} |
| 5673 |
|
5689 |
|
|
|
5690 |
Length RelativeviewportLength(CSSPrimitiveValue* primitiveValue, Document* document) |
| 5691 |
{ |
| 5692 |
Length viewportLength; |
| 5693 |
switch (primitiveValue->primitiveType()) { |
| 5694 |
case CSSPrimitiveValue::CSS_VW: |
| 5695 |
viewportLength = Length(primitiveValue->getDoubleValue(), RelativeViewport, ViewportWidth, document); |
| 5696 |
break; |
| 5697 |
case CSSPrimitiveValue::CSS_VH: |
| 5698 |
viewportLength = Length(primitiveValue->getDoubleValue(), RelativeViewport, ViewportHeight, document); |
| 5699 |
break; |
| 5700 |
case CSSPrimitiveValue::CSS_VMIN: |
| 5701 |
viewportLength = Length(primitiveValue->getDoubleValue(), RelativeViewport, ViewportMin, document); |
| 5702 |
break; |
| 5703 |
default: |
| 5704 |
break; |
| 5705 |
} |
| 5706 |
return viewportLength; |
| 5707 |
} |
| 5708 |
|
| 5674 |
} // namespace WebCore |
5709 |
} // namespace WebCore |