+2011-10-19 Alexander Pavlov <apavlov@chromium.org>
+
+ Strip trailing whitespace in the WebCore/css C++ code.
+ https://bugs.webkit.org/show_bug.cgi?id=70410
+
+ Reviewed by Dirk Schulze.
+
+ Only affected file names retained below for brevity.
+ Multiline boolean expression were fixed where necessary to avoid patch style violations.
+
+ * css/CSSBorderImageSliceValue.cpp:
+ * css/CSSBorderImageSliceValue.h:
+ * css/CSSBorderImageValue.cpp:
+ * css/CSSCanvasValue.cpp:
+ * css/CSSCanvasValue.h:
+ * css/CSSComputedStyleDeclaration.cpp:
+ * css/CSSCursorImageValue.cpp:
+ * css/CSSFontFace.cpp:
+ * css/CSSFontFace.h:
+ * css/CSSFontFaceSource.cpp:
+ * css/CSSFontFaceSource.h:
+ * css/CSSFontFaceSrcValue.cpp:
+ * css/CSSFontFaceSrcValue.h:
+ * css/CSSFontSelector.cpp:
+ * css/CSSFontSelector.h:
+ * css/CSSFunctionValue.cpp:
+ * css/CSSFunctionValue.h:
+ * css/CSSGradientValue.cpp:
+ * css/CSSGradientValue.h:
+ * css/CSSImageGeneratorValue.cpp:
+ * css/CSSImageGeneratorValue.h:
+ * css/CSSImageValue.cpp:
+ * css/CSSImageValue.h:
+ * css/CSSImportRule.cpp:
+ * css/CSSInitialValue.cpp:
+ * css/CSSInitialValue.h:
+ * css/CSSMutableStyleDeclaration.cpp:
+ * css/CSSMutableStyleDeclaration.h:
+ * css/CSSParser.cpp:
+ * css/CSSParser.h:
+ * css/CSSParserValues.cpp:
+ * css/CSSParserValues.h:
+ * css/CSSPrimitiveValue.cpp:
+ * css/CSSPrimitiveValue.h:
+ * css/CSSPrimitiveValueCache.cpp:
+ * css/CSSPrimitiveValueCache.h:
+ * css/CSSPrimitiveValueMappings.h:
+ * css/CSSProperty.cpp:
+ * css/CSSProperty.h:
+ * css/CSSPropertyLonghand.cpp:
+ * css/CSSReflectValue.cpp:
+ * css/CSSReflectValue.h:
+ * css/CSSReflectionDirection.h:
+ * css/CSSSegmentedFontFace.cpp:
+ * css/CSSSegmentedFontFace.h:
+ * css/CSSSelector.cpp:
+ * css/CSSSelector.h:
+ * css/CSSSelectorList.cpp:
+ * css/CSSSelectorList.h:
+ * css/CSSStyleApplyProperty.cpp:
+ * css/CSSStyleDeclaration.h:
+ * css/CSSStyleSelector.cpp:
+ * css/CSSStyleSelector.h:
+ * css/CSSStyleSheet.cpp:
+ * css/CSSTimingFunctionValue.cpp:
+ * css/CSSTimingFunctionValue.h:
+ * css/CSSUnicodeRangeValue.cpp:
+ * css/CSSUnicodeRangeValue.h:
+ * css/CSSValueList.cpp:
+ * css/CSSWrapShapes.cpp:
+ * css/CSSWrapShapes.h:
+ * css/FontValue.cpp:
+ * css/MediaList.cpp:
+ * css/MediaQuery.cpp:
+ * css/MediaQuery.h:
+ * css/MediaQueryEvaluator.h:
+ * css/MediaQueryExp.cpp:
+ * css/MediaQueryExp.h:
+ * css/Pair.h:
+ * css/SVGCSSComputedStyleDeclaration.cpp:
+ * css/SVGCSSParser.cpp:
+ * css/SVGCSSStyleSelector.cpp:
+ * css/SelectorChecker.cpp:
+ * css/SelectorChecker.h:
+ * css/StyleBase.cpp:
+ * css/StyleMedia.cpp:
+ * css/StyleMedia.h:
+ * css/StyleSheetList.cpp:
+ * css/StyleSheetList.h:
+ * css/WebKitCSSFilterValue.cpp:
+ * css/WebKitCSSFilterValue.h:
+ * css/WebKitCSSKeyframeRule.cpp:
+ * css/WebKitCSSKeyframeRule.h:
+ * css/WebKitCSSKeyframesRule.cpp:
+ * css/WebKitCSSKeyframesRule.h:
+ * css/WebKitCSSMatrix.cpp:
+ * css/WebKitCSSMatrix.h:
+ * css/WebKitCSSTransformValue.cpp:
+ * css/WebKitCSSTransformValue.h:
+
2011-10-19 Dirk Schulze <krit@webkit.org>
Make FilterEffect::apply() independent of image data management
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
{
// Dump the slices first.
String text = m_slices->cssText();
-
+
// Now the fill keywords if it is present.
if (m_fill)
text += " fill";
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSBorderImageSliceValue_h
{
// Image first.
String text;
-
+
if (m_image)
text += m_image->cssText();
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSCanvasValue_h
virtual void canvasDestroyed(HTMLCanvasElement*);
HTMLCanvasElement* element(Document*);
-
+
// The name of the canvas.
String m_name;
// The document supplies the element and owns it.
top = primitiveValueCache->createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
top = primitiveValueCache->createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_NUMBER);
-
- if (image.imageSlices().right() == image.imageSlices().top() && image.imageSlices().bottom() == image.imageSlices().top()
+
+ if (image.imageSlices().right() == image.imageSlices().top() && image.imageSlices().bottom() == image.imageSlices().top()
&& image.imageSlices().left() == image.imageSlices().top()) {
right = top;
bottom = top;
right = primitiveValueCache->createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
right = primitiveValueCache->createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_NUMBER);
-
+
if (image.imageSlices().bottom() == image.imageSlices().top() && image.imageSlices().right() == image.imageSlices().left()) {
bottom = top;
left = right;
bottom = primitiveValueCache->createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
bottom = primitiveValueCache->createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
-
+
if (image.imageSlices().left() == image.imageSlices().right())
left = right;
else {
right = primitiveValueCache->createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
else
right = primitiveValueCache->createValue(box.right());
-
+
if (box.bottom() == box.top() && box.right() == box.left()) {
bottom = top;
left = right;
bottom = primitiveValueCache->createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
else
bottom = primitiveValueCache->createValue(box.bottom());
-
+
if (box.left() == box.right())
left = right;
else {
{
RefPtr<CSSPrimitiveValue> horizontalRepeat;
RefPtr<CSSPrimitiveValue> verticalRepeat;
-
+
horizontalRepeat = primitiveValueCache->createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
if (image.horizontalRule() == image.verticalRule())
verticalRepeat = horizontalRepeat;
{
if (!image.hasImage())
return primitiveValueCache->createIdentifierValue(CSSValueNone);
-
+
// Image first.
RefPtr<CSSValue> imageValue;
if (image.image())
imageValue = image.image()->cssValue();
-
+
// Create the image slice.
RefPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(image, primitiveValueCache);
-
+
// Create the border area slices.
RefPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices(), primitiveValueCache);
offset = primitiveValueCache->createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
offset = zoomAdjustedPixelValue(reflection->offset().value(), style, primitiveValueCache);
-
+
return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask(), primitiveValueCache));
}
{
if (!renderer->isBox())
return LayoutRect();
-
+
RenderBox* box = toRenderBox(renderer);
return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
}
{
if (!renderer || style->transform().operations().isEmpty())
return primitiveValueCache->createIdentifierValue(CSSValueNone);
-
+
IntRect box = sizingBox(renderer);
TransformationMatrix transform;
{
if (!renderer || style->filter().operations().isEmpty())
return primitiveValueCache->createIdentifierValue(CSSValueNone);
-
+
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
RefPtr<WebKitCSSFilterValue> filterValue;
-
+
Vector<RefPtr<FilterOperation> >::const_iterator end = style->filter().operations().end();
for (Vector<RefPtr<FilterOperation> >::const_iterator it = style->filter().operations().begin(); it != end; ++it) {
FilterOperation* filterOperation = (*it).get();
}
list->append(filterValue);
}
-
+
return list.release();
}
#endif
RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
if (!style)
return 0;
-
+
CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get();
if (int keywordSize = style->fontDescription().keywordSize())
return;
LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID)));
-}
+}
static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
{
if (!style)
return 0;
-
+
CSSPrimitiveValueCache* primitiveValueCache = node->document()->cssPrimitiveValueCache().get();
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
EFillBox box = isClip ? layers->clip() : layers->origin();
return primitiveValueCache->createValue(box);
}
-
+
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache));
list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get(), primitiveValueCache));
return list.release();
- }
+ }
case CSSPropertyWebkitBorderHorizontalSpacing:
return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache);
case CSSPropertyWebkitBorderVerticalSpacing:
else {
list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get(), primitiveValueCache));
list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get(), primitiveValueCache));
-
+
}
return list.release();
}
#if ENABLE(TOUCH_EVENTS)
case CSSPropertyWebkitTapHighlightColor:
return currentColorOrValidColor(style.get(), style->tapHighlightColor());
-#endif
+#endif
case CSSPropertyWebkitUserDrag:
return primitiveValueCache->createValue(style->userDrag());
case CSSPropertyWebkitUserSelect:
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
#include "config.h"
#include "CSSCursorImageValue.h"
{
String url = getStringValue();
-#if ENABLE(SVG)
+#if ENABLE(SVG)
if (isSVGCursorIdentifier(url) && loader && loader->document()) {
// FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, loader->document()))
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSFontFace_h
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
return m_svgFontFaceElement.get();
}
-void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element)
-{
+void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element)
+{
m_svgFontFaceElement = element;
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSFontFaceSource_h
void setFontFace(CSSFontFace* face) { m_face = face; }
virtual void fontLoaded(CachedFont*);
-
+
SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
-
+
void pruneTable();
#if ENABLE(SVG_FONTS)
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSFontFaceSrcValue_h
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSFontSelector_h
virtual ~CSSFontSelector();
virtual FontData* getFontData(const FontDescription& fontDescription, const AtomicString& familyName);
-
+
void clearDocument() { m_document = 0; }
void addFontFaceRule(const CSSFontFaceRule*);
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSFunctionValue_h
}
virtual ~CSSFunctionValue();
-
+
virtual String cssText() const;
private:
explicit CSSFunctionValue(CSSParserFunction*);
-
+
String m_name;
RefPtr<CSSValueList> m_args;
};
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
if (result)
return result;
}
-
+
// We need to create an image.
RefPtr<Image> newImage = GeneratedImage::create(createGradient(renderer, size), size);
if (cacheable)
{
double aVal = a.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER);
double bVal = b.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER);
-
+
return aVal < bVal;
}
}
static inline int blend(int from, int to, float progress)
-{
+{
return int(from + (to - from) * progress);
}
Color color;
float offset;
bool specified;
-
+
GradientStop()
: offset(0)
, specified(false)
void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, RenderStyle* rootStyle, float maxLengthForRepeat)
{
RenderStyle* style = renderer->style();
-
+
if (m_deprecatedType) {
sortStopsIfNeeded();
offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100;
else
offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_NUMBER);
-
+
gradient->addColorStop(offset, color);
}
}
size_t numStops = m_stops.size();
-
+
Vector<GradientStop> stops(numStops);
-
+
float gradientLength = 0;
bool computedGradientLength = false;
-
+
FloatPoint gradientStart = gradient->p0();
FloatPoint gradientEnd;
if (isLinearGradient())
gradientEnd = gradient->p1();
else if (isRadialGradient())
gradientEnd = gradientStart + FloatSize(gradient->endRadius(), 0);
-
+
for (size_t i = 0; i < numStops; ++i) {
const CSSGradientColorStop& stop = m_stops[i];
if (stops[prevSpecifiedIndex].specified)
break;
}
-
+
if (stops[i].offset < stops[prevSpecifiedIndex].offset)
stops[i].offset = stops[prevSpecifiedIndex].offset;
}
}
ASSERT(stops[0].specified && stops[numStops - 1].specified);
-
+
// If any color-stop still does not have a position, then, for each run of adjacent
// color-stops without positions, set their positions so that they are evenly spaced
// between the preceding and following color-stops with positions.
float lastSpecifiedOffset = stops[unspecifiedRunStart - 1].offset;
float nextSpecifiedOffset = stops[unspecifiedRunEnd].offset;
float delta = (nextSpecifiedOffset - lastSpecifiedOffset) / (unspecifiedRunEnd - unspecifiedRunStart + 1);
-
+
for (size_t j = unspecifiedRunStart; j < unspecifiedRunEnd; ++j)
stops[j].offset = lastSpecifiedOffset + (j - unspecifiedRunStart + 1) * delta;
}
FloatSize gradientSize(gradientStart - gradientEnd);
gradientLength = gradientSize.diagonalLength();
}
-
+
if (maxLengthForRepeat > gradientLength)
maxExtent = maxLengthForRepeat / gradientLength;
}
if (firstOffset > 0) {
float currOffset = firstOffset;
size_t srcStopOrdinal = originalNumStops - 1;
-
+
while (true) {
GradientStop newStop = stops[originalFirstStopIndex + srcStopOrdinal];
newStop.offset = currOffset;
srcStopOrdinal = (srcStopOrdinal + originalNumStops - 1) % originalNumStops;
}
}
-
+
// Work forwards from the end, adding stops until we get one after 1.
float lastOffset = stops[stops.size() - 1].offset;
if (lastOffset < maxExtent) {
}
}
}
-
+
numStops = stops.size();
-
+
// If the gradient goes outside the 0-1 range, normalize it by moving the endpoints, and adjusting the stops.
if (numStops > 1 && (stops[0].offset < 0 || stops[numStops - 1].offset > 1)) {
if (isLinearGradient()) {
break;
}
}
-
+
if (firstZeroOrGreaterIndex > 0) {
if (firstZeroOrGreaterIndex < numStops && stops[firstZeroOrGreaterIndex].offset > 0) {
float prevOffset = stops[firstZeroOrGreaterIndex - 1].offset;
float nextOffset = stops[firstZeroOrGreaterIndex].offset;
-
+
float interStopProportion = -prevOffset / (nextOffset - prevOffset);
Color blendedColor = blend(stops[firstZeroOrGreaterIndex - 1].color, stops[firstZeroOrGreaterIndex].color, interStopProportion);
stops[i].offset = 0;
}
}
-
+
for (size_t i = 0; i < numStops; ++i)
stops[i].offset /= scale;
-
+
gradient->setStartRadius(gradient->startRadius() * scale);
gradient->setEndRadius(gradient->endRadius() * scale);
}
}
-
+
for (unsigned i = 0; i < numStops; i++)
gradient->addColorStop(stops[i].offset, stops[i].color);
if (second)
result.setY(positionFromValue(second, style, rootStyle, size, false));
-
+
return result;
}
if (unitType == CSSPrimitiveValue::CSS_EMS || unitType == CSSPrimitiveValue::CSS_EXS || unitType == CSSPrimitiveValue::CSS_REMS)
return false;
}
-
+
return true;
}
angleDeg = fmodf(angleDeg, 360);
if (angleDeg < 0)
angleDeg += 360;
-
+
if (!angleDeg) {
firstPoint.set(0, 0);
secondPoint.set(size.width(), 0);
return;
}
-
+
if (angleDeg == 90) {
firstPoint.set(0, size.height());
secondPoint.set(0, 0);
secondPoint.set(0, 0);
return;
}
-
+
if (angleDeg == 270) {
firstPoint.set(0, 0);
secondPoint.set(0, size.height());
// We find the endpoint by computing the intersection of the line formed by the slope,
// and a line perpendicular to it that intersects the corner.
float perpendicularSlope = -1 / slope;
-
+
// Compute start corner relative to center.
float halfHeight = size.height() / 2;
float halfWidth = size.width() / 2;
float c = endCorner.y() - perpendicularSlope * endCorner.x();
float endX = c / (slope - perpendicularSlope);
float endY = perpendicularSlope * endX + c;
-
+
// We computed the end point, so set the second point, flipping the Y to account for angles going anticlockwise.
secondPoint.set(halfWidth + endX, size.height() - (halfHeight + endY));
// Reflect around the center for the start point.
PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* renderer, const IntSize& size)
{
ASSERT(!size.isEmpty());
-
+
RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
FloatPoint firstPoint;
endPointsFromAngle(angle, size, firstPoint, secondPoint);
} else {
firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
-
+
if (m_secondX || m_secondY)
secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);
else {
result = *widthOrHeight * radius->getFloatValue() / 100;
else
result = radius->computeLength<float>(style, rootStyle, zoomFactor);
-
+
return result;
}
PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* renderer, const IntSize& size)
{
ASSERT(!size.isEmpty());
-
+
RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
secondPoint.setX(size.width() / 2);
if (!m_secondY)
secondPoint.setY(size.height() / 2);
-
+
float firstRadius = 0;
if (m_firstRadius)
firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle);
GradientShape shape = Ellipse;
if (m_shape && m_shape->primitiveType() == CSSPrimitiveValue::CSS_IDENT && m_shape->getIdent() == CSSValueCircle)
shape = Circle;
-
+
enum GradientFill { ClosestSide, ClosestCorner, FarthestSide, FarthestCorner };
GradientFill fill = FarthestCorner;
-
+
if (m_sizingBehavior && m_sizingBehavior->primitiveType() == CSSPrimitiveValue::CSS_IDENT) {
switch (m_sizingBehavior->getIdent()) {
case CSSValueContain:
break;
}
}
-
+
// Now compute the end radii based on the second point, shape and fill.
-
+
// Horizontal
switch (fill) {
case ClosestSide: {
// that it would if closest-side or farthest-side were specified, as appropriate.
float xDist = min(secondPoint.x(), size.width() - secondPoint.x());
float yDist = min(secondPoint.y(), size.height() - secondPoint.y());
-
+
secondRadius = horizontalEllipseRadius(corner - secondPoint, xDist / yDist);
aspectRatio = xDist / yDist;
}
// that it would if closest-side or farthest-side were specified, as appropriate.
float xDist = max(secondPoint.x(), size.width() - secondPoint.x());
float yDist = max(secondPoint.y(), size.height() - secondPoint.y());
-
+
secondRadius = horizontalEllipseRadius(corner - secondPoint, xDist / yDist);
aspectRatio = xDist / yDist;
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSGradientValue_h
void setFirstY(PassRefPtr<CSSPrimitiveValue> val) { m_firstY = val; }
void setSecondX(PassRefPtr<CSSPrimitiveValue> val) { m_secondX = val; }
void setSecondY(PassRefPtr<CSSPrimitiveValue> val) { m_secondY = val; }
-
+
void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); }
Vector<CSSGradientColorStop>& stops() { return m_stops; }
void sortStopsIfNeeded();
-
+
virtual bool isLinearGradient() const { return false; }
virtual bool isRadialGradient() const { return false; }
-
+
bool isRepeating() const { return m_repeating; }
bool deprecatedType() const { return m_deprecatedType; } // came from -webkit-gradient
, m_repeating(repeat == Repeating)
{
}
-
+
void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);
// Create the gradient for a given size.
// Resolve points/radii to front end values.
FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);
-
+
bool isCacheable() const;
// Points. Some of these may be null for linear gradients.
RefPtr<CSSPrimitiveValue> m_firstX;
RefPtr<CSSPrimitiveValue> m_firstY;
-
+
RefPtr<CSSPrimitiveValue> m_secondX;
RefPtr<CSSPrimitiveValue> m_secondY;
-
+
// Stops
Vector<CSSGradientColorStop> m_stops;
bool m_stopsSorted;
// Create the gradient for a given size.
virtual PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
-
+
// Resolve points/radii to front end values.
float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, float* widthOrHeight = 0);
-
+
// These may be null for non-deprecated gradients.
RefPtr<CSSPrimitiveValue> m_firstRadius;
RefPtr<CSSPrimitiveValue> m_secondRadius;
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSImageGeneratorValue_h
virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) = 0;
StyleGeneratedImage* generatedImage();
-
+
virtual bool isFixedSize() const { return false; }
virtual IntSize fixedSize(const RenderObject*) { return IntSize(); }
-
+
protected:
CSSImageGeneratorValue();
-
+
Image* getImage(RenderObject*, const IntSize&);
void putImage(const IntSize&, PassRefPtr<Image>);
const RenderObjectSizeCountMap& clients() const { return m_imageCache.clients(); }
m_image = StyleCachedImage::create(cachedImage);
}
}
-
+
return (m_image && m_image->isCachedImage()) ? static_cast<StyleCachedImage*>(m_image.get()) : 0;
}
virtual StyleCachedImage* cachedImage(CachedResourceLoader*);
// Returns a StyleCachedImage if the image is cached already, otherwise a StylePendingImage.
StyleImage* cachedOrPendingImage();
-
+
protected:
CSSImageValue(const String& url);
// in our parent chain with the same URL, then just bail.
StyleBase* root = this;
for (StyleBase* curr = parent(); curr; curr = curr->parent()) {
- // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL.
+ // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL.
if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->finalURL().string())
return;
root = curr;
namespace WebCore {
unsigned short CSSInitialValue::cssValueType() const
-{
- return CSS_INITIAL;
+{
+ return CSS_INITIAL;
}
String CSSInitialValue::cssText() const
}
virtual String cssText() const;
-
+
private:
CSSInitialValue(bool implicit)
: m_implicit(implicit)
static_cast<CSSMutableValue*>(value)->setNode(0);
}
}
-
+
CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other)
{
ASSERT(!m_iteratorCount);
}
case CSSPropertyBackground: {
const int properties[9] = { CSSPropertyBackgroundColor,
- CSSPropertyBackgroundImage,
- CSSPropertyBackgroundRepeatX,
- CSSPropertyBackgroundRepeatY,
- CSSPropertyBackgroundAttachment,
- CSSPropertyBackgroundPositionX,
- CSSPropertyBackgroundPositionY,
+ CSSPropertyBackgroundImage,
+ CSSPropertyBackgroundRepeatX,
+ CSSPropertyBackgroundRepeatY,
+ CSSPropertyBackgroundAttachment,
+ CSSPropertyBackgroundPositionX,
+ CSSPropertyBackgroundPositionY,
CSSPropertyBackgroundClip,
- CSSPropertyBackgroundOrigin };
+ CSSPropertyBackgroundOrigin };
return getLayeredShorthandValue(properties);
}
case CSSPropertyBorder: {
return getLayeredShorthandValue(properties);
}
case CSSPropertyWebkitMask: {
- const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
+ const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskClip,
CSSPropertyWebkitMaskOrigin };
return getLayeredShorthandValue(properties);
// Begin by collecting the properties into an array.
Vector< RefPtr<CSSValue> > values(size);
size_t numLayers = 0;
-
+
for (size_t i = 0; i < size; ++i) {
values[i] = getPropertyCSSValue(properties[i]);
if (values[i]) {
numLayers = max<size_t>(1U, numLayers);
}
}
-
+
// Now stitch the properties together. Implicit initial values are flagged as such and
// can safely be omitted.
for (size_t i = 0; i < numLayers; i++) {
value = static_cast<CSSValueList*>(values[j].get())->item(i);
else {
value = values[j];
-
+
// Color only belongs in the last layer.
if (properties[j] == CSSPropertyBackgroundColor) {
if (i != numLayers - 1)
// We need to report background-repeat as it was written in the CSS. If the property is implicit,
// then it was written with only one value. Here we figure out which value that was so we can
- // report back correctly.
+ // report back correctly.
if (properties[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(properties[j])) {
// BUG 49055: make sure the value was not reset in the layer check just above.
yValue = static_cast<CSSValueList*>(nextValue.get())->itemWithoutBoundsCheck(i);
else
yValue = nextValue;
-
+
int xId = static_cast<CSSPrimitiveValue*>(value.get())->getIdent();
int yId = static_cast<CSSPrimitiveValue*>(yValue.get())->getIdent();
if (xId != yId) {
}
}
}
-
+
if (value && !value->isImplicitInitialValue()) {
if (!layerRes.isNull())
layerRes += " ";
layerRes += value->cssText();
}
}
-
+
if (!layerRes.isNull()) {
if (!res.isNull())
res += ", ";
return property ? property->value() : 0;
}
-bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool notifyChanged)
+bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool notifyChanged)
{
CSSPropertyLonghand longhand = longhandForProperty(propertyID);
if (longhand.length()) {
// FIXME: Return an equivalent shorthand when possible.
return String();
}
-
+
CSSProperty* foundProperty = findPropertyWithId(propertyID);
if (!foundProperty)
return String();
-
+
String value = returnText ? foundProperty->value()->cssText() : String();
// A more efficient removal strategy would involve marking entries as empty
return success;
}
-
+
void CSSMutableStyleDeclaration::setPropertyInternal(const CSSProperty& property, CSSProperty* slot)
{
ASSERT(!m_iteratorCount);
String CSSMutableStyleDeclaration::cssText() const
{
String result = "";
-
+
const CSSProperty* positionXProp = 0;
const CSSProperty* positionYProp = 0;
const CSSProperty* repeatXProp = 0;
const CSSProperty* repeatYProp = 0;
-
+
unsigned size = m_properties.size();
for (unsigned n = 0; n < size; ++n) {
const CSSProperty& prop = m_properties[n];
else
result += prop.cssText();
}
-
+
// FIXME: This is a not-so-nice way to turn x/y positions into single background-position in output.
- // It is required because background-position-x/y are non-standard properties and WebKit generated output
+ // It is required because background-position-x/y are non-standard properties and WebKit generated output
// would not work in Firefox (<rdar://problem/5143183>)
// It would be a better solution if background-position was CSS_PAIR.
if (positionXProp && positionYProp && positionXProp->isImportant() == positionYProp->isImportant()) {
String positionValue;
const int properties[2] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY };
- if (positionXProp->value()->isValueList() || positionYProp->value()->isValueList())
+ if (positionXProp->value()->isValueList() || positionYProp->value()->isValueList())
positionValue = getLayeredShorthandValue(properties);
else
positionValue = positionXProp->value()->cssText() + " " + positionYProp->value()->cssText();
result += "background-position: " + positionValue + (positionXProp->isImportant() ? " !important" : "") + "; ";
} else {
- if (positionXProp)
+ if (positionXProp)
result += positionXProp->cssText();
if (positionYProp)
result += positionYProp->cssText();
if (repeatXProp && repeatYProp && repeatXProp->isImportant() == repeatYProp->isImportant()) {
String repeatValue;
const int repeatProperties[2] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY };
- if (repeatXProp->value()->isValueList() || repeatYProp->value()->isValueList())
+ if (repeatXProp->value()->isValueList() || repeatYProp->value()->isValueList())
repeatValue = getLayeredShorthandValue(repeatProperties);
else
repeatValue = repeatXProp->value()->cssText() + " " + repeatYProp->value()->cssText();
result += "background-repeat: " + repeatValue + (repeatXProp->isImportant() ? " !important" : "") + "; ";
} else {
- if (repeatXProp)
+ if (repeatXProp)
result += repeatXProp->cssText();
if (repeatYProp)
result += repeatYProp->cssText();
void CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged)
{
ASSERT(!m_iteratorCount);
-
+
if (m_properties.isEmpty())
return;
-
+
// FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless.
HashSet<int> toRemove;
for (unsigned i = 0; i < length; ++i)
toRemove.add(set[i]);
-
+
Vector<CSSProperty, 4> newProperties;
newProperties.reserveInitialCapacity(m_properties.size());
-
+
unsigned size = m_properties.size();
for (unsigned n = 0; n < size; ++n) {
const CSSProperty& property = m_properties[n];
bool changed = newProperties.size() != m_properties.size();
m_properties = newProperties;
-
+
if (changed && notifyChanged)
setNeedsStyleRecalc();
}
}
const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) const
-{
+{
for (int n = m_properties.size() - 1 ; n >= 0; --n) {
if (propertyID == m_properties[n].m_id)
return &m_properties[n];
CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current);
CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclarationConstIterator& o);
~CSSMutableStyleDeclarationConstIterator();
-
+
const CSSProperty& operator*() const { return *m_current; }
const CSSProperty* operator->() const { return m_current; }
-
+
bool operator!=(const CSSMutableStyleDeclarationConstIterator& o) { ASSERT(m_decl == o.m_decl); return m_current != o.m_current; }
bool operator==(const CSSMutableStyleDeclarationConstIterator& o) { ASSERT(m_decl == o.m_decl); return m_current == o.m_current; }
-
+
CSSMutableStyleDeclarationConstIterator& operator=(const CSSMutableStyleDeclarationConstIterator& o);
-
+
CSSMutableStyleDeclarationConstIterator& operator++();
CSSMutableStyleDeclarationConstIterator& operator--();
}
CSSMutableStyleDeclaration& operator=(const CSSMutableStyleDeclaration&);
-
+
typedef CSSMutableStyleDeclarationConstIterator const_iterator;
const_iterator begin() { return const_iterator(this, m_properties.begin()); }
bool setProperty(int propertyID, const String& value, bool important = false, bool notifyChanged = true);
String removeProperty(int propertyID, bool notifyChanged = true, bool returnText = false);
-
+
// setLengthProperty treats integers as pixels! (Needed for conversion of HTML attributes.)
void setLengthProperty(int propertyId, const String& value, bool important, bool multiLength = false);
void setStringProperty(int propertyId, const String& value, CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value
void addParsedProperties(const CSSProperty* const *, int numProperties);
// This does no change notifications since it's only called by createMarkup.
void addParsedProperty(const CSSProperty&);
-
+
PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const;
void removeBlockProperties();
void removePropertiesInSet(const int* set, unsigned length, bool notifyChanged = true);
bool useStrictParsing() const { return m_strictParsing; }
void addSubresourceStyleURLs(ListHashSet<KURL>&);
-
+
bool propertiesEqual(const CSSMutableStyleDeclaration* o) const { return m_properties == o->m_properties; }
bool isInlineStyleDeclaration();
friend class CSSMutableStyleDeclarationConstIterator;
};
-
-inline CSSMutableStyleDeclarationConstIterator::CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current)
+
+inline CSSMutableStyleDeclarationConstIterator::CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current)
: m_decl(decl)
, m_current(current)
-{
+{
#ifndef NDEBUG
- const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
#endif
}
, m_current(o.m_current)
{
#ifndef NDEBUG
- const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
#endif
}
-inline CSSMutableStyleDeclarationConstIterator::~CSSMutableStyleDeclarationConstIterator()
+inline CSSMutableStyleDeclarationConstIterator::~CSSMutableStyleDeclarationConstIterator()
{
#ifndef NDEBUG
const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount--;
m_decl = o.m_decl;
m_current = o.m_current;
#ifndef NDEBUG
- const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
#endif
return *this;
}
-
-inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator++()
-{
+
+inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator++()
+{
ASSERT(m_current != const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_properties.end());
++m_current;
- return *this;
+ return *this;
}
-inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator--()
-{
- --m_current;
- return *this;
+inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator--()
+{
+ --m_current;
+ return *this;
}
} // namespace WebCore
case CSSPropertyMinWidth:
case CSSPropertyPaddingBottom:
case CSSPropertyPaddingLeft:
- case CSSPropertyPaddingRight:
+ case CSSPropertyPaddingRight:
case CSSPropertyPaddingTop:
case CSSPropertyWebkitLogicalWidth:
case CSSPropertyWebkitLogicalHeight:
case CSSPropertyBottom:
case CSSPropertyLeft:
case CSSPropertyMarginBottom:
- case CSSPropertyMarginLeft:
- case CSSPropertyMarginRight:
+ case CSSPropertyMarginLeft:
+ case CSSPropertyMarginRight:
case CSSPropertyMarginTop:
case CSSPropertyRight:
case CSSPropertyTextIndent:
m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
m_hasFontFaceOnlyValues = false;
}
-
+
void CSSParser::setStyleSheet(CSSStyleSheet* styleSheet)
{
m_styleSheet = styleSheet;
validPrimitive = true;
break;
case CSSPropertySpeak: // none | normal | spell-out | digits | literal-punctuation | no-punctuation | inherit
- if (id == CSSValueNone || id == CSSValueNormal || id == CSSValueSpellOut || id == CSSValueDigits
+ if (id == CSSValueNone || id == CSSValueNormal || id == CSSValueSpellOut || id == CSSValueDigits
|| id == CSSValueLiteralPunctuation || id == CSSValueNoPunctuation)
validPrimitive = true;
break;
-
+
case CSSPropertyTextIndent: // <length> | <percentage> | inherit
validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict));
break;
validPrimitive = id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueBaseline || id == CSSValueStretch;
break;
case CSSPropertyWebkitFlexFlow:
- // FIXME: -webkit-flex-flow takes a second "wrap" value.
+ // FIXME: -webkit-flex-flow takes a second "wrap" value.
validPrimitive = id == CSSValueRow || id == CSSValueRowReverse || id == CSSValueColumn || id == CSSValueColumnReverse;
break;
#endif
if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) && !parsedProperty[i]) {
// If background-origin wasn't present, then reset background-clip also.
addFillValue(clipValue, CSSInitialValue::createImplicit());
- }
+ }
}
parsedProperty[i] = false;
}
return CSSStepsTimingFunctionValue::create(numSteps, stepAtStart);
}
-
+
if (equalIgnoringCase(value->function->name, "cubic-bezier(")) {
// For cubic bezier, 4 values must be specified.
if (!args || args->size() != 7)
return CSSCubicBezierTimingFunctionValue::create(x1, y1, x2, y2);
}
-
+
return 0;
}
PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeRect(CSSParserValueList* args)
{
ASSERT(args);
-
+
// rect(x, y, width, height, [[rx], ry])
if (args->size() != 7 && args->size() != 9 && args->size() != 11)
return 0;
-
+
RefPtr<CSSWrapShapeRect> shape = CSSWrapShapeRect::create();
-
+
unsigned argumentNumber = 0;
CSSParserValue* argument = args->current();
while (argument) {
if (!validUnit(argument, FLength, m_strict))
return 0;
-
- RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
+
+ RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
(CSSPrimitiveValue::UnitTypes) argument->unit);
ASSERT(argumentNumber < 6);
switch (argumentNumber) {
if (argument) {
if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
return 0;
-
+
argument = args->next();
}
argumentNumber++;
}
-
+
if (argumentNumber < 4)
- return 0;
+ return 0;
return shape;
}
PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeCircle(CSSParserValueList* args)
{
ASSERT(args);
-
+
// circle(x, y, r)
if (args->size() != 5)
return 0;
-
+
RefPtr<CSSWrapShapeCircle> shape = CSSWrapShapeCircle::create();
-
+
unsigned argumentNumber = 0;
CSSParserValue* argument = args->current();
while (argument) {
if (!validUnit(argument, FLength, m_strict))
return 0;
- RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
+ RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
(CSSPrimitiveValue::UnitTypes) argument->unit);
ASSERT(argumentNumber < 3);
switch (argumentNumber) {
shape->setRadius(length);
break;
}
-
+
argument = args->next();
if (argument) {
if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
- return 0;
+ return 0;
argument = args->next();
}
argumentNumber++;
}
-
+
if (argumentNumber < 3)
- return 0;
+ return 0;
return shape;
}
PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeEllipse(CSSParserValueList* args)
{
ASSERT(args);
-
+
// ellipse(x, y, rx, ry)
if (args->size() != 7)
return 0;
-
+
RefPtr<CSSWrapShapeEllipse> shape = CSSWrapShapeEllipse::create();
unsigned argumentNumber = 0;
CSSParserValue* argument = args->current();
while (argument) {
if (!validUnit(argument, FLength, m_strict))
return 0;
-
- RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
+
+ RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
(CSSPrimitiveValue::UnitTypes) argument->unit);
ASSERT(argumentNumber < 4);
switch (argumentNumber) {
shape->setRadiusY(length);
break;
}
-
+
argument = args->next();
if (argument) {
if (argument->unit != CSSParserValue::Operator || argument->iValue != ',')
}
argumentNumber++;
}
-
+
if (argumentNumber < 4)
return 0;
return shape;
unsigned size = args->size();
if (!size)
return 0;
-
+
RefPtr<CSSWrapShapePolygon> shape = CSSWrapShapePolygon::create();
CSSParserValue* argument = args->current();
argument = args->next();
size -= 2;
}
-
+
// <length>, <length> ... <length>, <length> -> each pair has 3 elements
if (!size || (size % 3))
return 0;
-
+
CSSParserValue* argumentX = argument;
while (argumentX) {
if (!validUnit(argumentX, FLength, m_strict))
return 0;
-
+
CSSParserValue* comma = args->next();
if (!comma || comma->unit != CSSParserValue::Operator || comma->iValue != ',')
return 0;
-
+
CSSParserValue* argumentY = args->next();
if (!argumentY || !validUnit(argumentY, FLength, m_strict))
return 0;
-
- RefPtr<CSSPrimitiveValue> xLength = primitiveValueCache()->createValue(argumentX->fValue,
+
+ RefPtr<CSSPrimitiveValue> xLength = primitiveValueCache()->createValue(argumentX->fValue,
(CSSPrimitiveValue::UnitTypes) argumentX->unit);
- RefPtr<CSSPrimitiveValue> yLength = primitiveValueCache()->createValue(argumentY->fValue,
+ RefPtr<CSSPrimitiveValue> yLength = primitiveValueCache()->createValue(argumentY->fValue,
(CSSPrimitiveValue::UnitTypes) argumentY->unit);
-
+
shape->appendPoint(xLength.release(), yLength.release());
-
+
argumentX = args->next();
}
-
+
return shape;
}
if (!args)
return false;
-
+
RefPtr<CSSWrapShape> shape;
-
+
if (equalIgnoringCase(value->function->name, "rect("))
shape = parseWrapShapeRect(args);
else if (equalIgnoringCase(value->function->name, "circle("))
, m_allowRepeat(true)
, m_allowSlash(false)
, m_requireWidth(false)
- , m_requireOutset(false)
+ , m_requireOutset(false)
{}
bool canAdvance() const { return m_canAdvance; }
bool requireWidth() const { return m_requireWidth; }
bool requireOutset() const { return m_requireOutset; }
-
+
void commitImage(PassRefPtr<CSSValue> image)
{
m_image = image;
// Make our new border image value now.
return CSSBorderImageValue::create(m_image, m_imageSlice, m_borderSlice, m_outset, m_repeat);
}
-
+
CSSPrimitiveValueCache* m_primitiveValueCache;
bool m_canAdvance;
bool m_allowImageSlice;
bool m_allowRepeat;
bool m_allowSlash;
-
+
bool m_requireWidth;
bool m_requireOutset;
if (!context.canAdvance() && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/')
context.commitSlash();
-
+
if (!context.canAdvance() && context.allowImage()) {
if (val->unit == CSSPrimitiveValue::CSS_URI && m_styleSheet) {
// FIXME: The completeURL call should be done when using the CSSImageValue,
} else if (val->id == CSSValueNone)
context.commitImage(CSSImageValue::create());
}
-
+
if (!context.canAdvance() && context.allowImageSlice()) {
RefPtr<CSSBorderImageSliceValue> imageSlice;
if (parseBorderImageSlice(propId, imageSlice))
context.commitImageSlice(imageSlice.release());
- }
-
+ }
+
if (!context.canAdvance() && context.allowRepeat()) {
RefPtr<CSSValue> repeat;
if (parseBorderImageRepeat(repeat))
context.commitRepeat(repeat);
}
-
+
if (!context.canAdvance() && context.requireWidth()) {
RefPtr<CSSPrimitiveValue> borderSlice;
if (parseBorderImageWidth(borderSlice))
context.commitBorderWidth(borderSlice.release());
- }
-
+ }
+
if (!context.canAdvance() && context.requireOutset()) {
RefPtr<CSSPrimitiveValue> borderOutset;
if (parseBorderImageOutset(borderOutset))
context.commitBorderOutset(borderOutset.release());
- }
-
+ }
+
if (!context.canAdvance())
return false;
-
+
m_valueList->next();
}
firstValue = primitiveValueCache()->createIdentifierValue(val->id);
else
return false;
-
+
val = m_valueList->next();
if (val) {
if (isBorderImageRepeatKeyword(val->id))
// Make our new border image value now.
return CSSBorderImageSliceValue::create(m_primitiveValueCache->createValue(quad.release()), m_fill);
}
-
+
private:
CSSPrimitiveValueCache* m_primitiveValueCache;
RefPtr<CSSPrimitiveValue> m_right;
RefPtr<CSSPrimitiveValue> m_bottom;
RefPtr<CSSPrimitiveValue> m_left;
-
+
bool m_fill;
};
val = m_primitiveValueCache->createIdentifierValue(v->id);
else
val = m_primitiveValueCache->createValue(v->fValue, (CSSPrimitiveValue::UnitTypes)v->unit);
-
+
if (!m_top)
m_top = val;
else if (!m_right)
// Make our new value now.
return m_primitiveValueCache->createValue(quad.release());
}
-
+
private:
CSSPrimitiveValueCache* m_primitiveValueCache;
{
RefPtr<CSSPrimitiveValue> result;
if (a->unit == CSSPrimitiveValue::CSS_IDENT) {
- if ((equalIgnoringCase(a->string, "left") && horizontal) ||
- (equalIgnoringCase(a->string, "top") && !horizontal))
+ if ((equalIgnoringCase(a->string, "left") && horizontal)
+ || (equalIgnoringCase(a->string, "top") && !horizontal))
result = primitiveValueCache->createValue(0., CSSPrimitiveValue::CSS_PERCENTAGE);
- else if ((equalIgnoringCase(a->string, "right") && horizontal) ||
- (equalIgnoringCase(a->string, "bottom") && !horizontal))
+ else if ((equalIgnoringCase(a->string, "right") && horizontal)
+ || (equalIgnoringCase(a->string, "bottom") && !horizontal))
result = primitiveValueCache->createValue(100., CSSPrimitiveValue::CSS_PERCENTAGE);
else if (equalIgnoringCase(a->string, "center"))
result = primitiveValueCache->createValue(50., CSSPrimitiveValue::CSS_PERCENTAGE);
if (!args)
return false;
- if (equalIgnoringCase(a->function->name, "from(") ||
- equalIgnoringCase(a->function->name, "to(")) {
+ if (equalIgnoringCase(a->function->name, "from(")
+ || equalIgnoringCase(a->function->name, "to(")) {
// The "from" and "to" stops expect 1 argument.
if (args->size() != 1)
return false;
bool CSSParser::parseLinearGradient(RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
RefPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating);
-
+
// Walk the arguments.
CSSParserValueList* args = m_valueList->current()->function->args.get();
if (!args || !args->size())
// Look for angle.
if (validUnit(a, FAngle, true)) {
result->setAngle(createPrimitiveNumericValue(a));
-
+
a = args->next();
expectComma = true;
} else {
// Look one or two optional keywords that indicate a side or corner.
RefPtr<CSSPrimitiveValue> startX, startY;
-
+
RefPtr<CSSPrimitiveValue> location;
bool isHorizontal = false;
if ((location = valueFromSideKeyword(a, isHorizontal, primitiveValueCache()))) {
startX = location;
else
startY = location;
-
+
a = args->next();
if (a) {
if ((location = valueFromSideKeyword(a, isHorizontal, primitiveValueCache()))) {
expectComma = true;
}
-
+
if (!startX && !startY)
startY = primitiveValueCache()->createIdentifierValue(CSSValueTop);
-
+
result->setFirstX(startX.release());
result->setFirstY(startY.release());
}
bool CSSParser::parseRadialGradient(RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
{
RefPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating);
-
+
// Walk the arguments.
CSSParserValueList* args = m_valueList->current()->function->args.get();
if (!args || !args->size())
a = args->current();
if (!a)
return false;
-
+
if (centerX || centerY) {
// Comma
if (a->unit != CSSParserValue::Operator || a->iValue != ',')
if (!a)
return false;
}
-
+
ASSERT(!centerX || centerX->isPrimitiveValue());
ASSERT(!centerY || centerY->isPrimitiveValue());
// CSS3 radial gradients always share the same start and end point.
result->setFirstY(static_cast<CSSPrimitiveValue*>(centerY.get()));
result->setSecondY(static_cast<CSSPrimitiveValue*>(centerY.get()));
-
+
RefPtr<CSSPrimitiveValue> shapeValue;
RefPtr<CSSPrimitiveValue> sizeValue;
for (int i = 0; i < 2; ++i) {
if (a->unit != CSSPrimitiveValue::CSS_IDENT)
break;
-
+
bool foundValue = false;
switch (a->id) {
case CSSValueCircle:
expectComma = true;
}
}
-
+
result->setShape(shapeValue);
result->setSizingBehavior(sizeValue);
-
+
// Or, two lengths or percentages
RefPtr<CSSPrimitiveValue> horizontalSize;
RefPtr<CSSPrimitiveValue> verticalSize;
// Must have neither or both.
if (!horizontalSize != !verticalSize)
return false;
-
+
result->setEndHorizontalSize(horizontalSize);
result->setEndVerticalSize(verticalSize);
a = valueList->next();
}
}
-
+
gradient->addStop(stop);
expectComma = true;
}
return false;
} else if (!validUnit(argument, FNumber, true))
return false;
-
+
// Check parameter values.
if (filterType == WebKitCSSFilterValue::GrayscaleFilterOperation
|| filterType == WebKitCSSFilterValue::SepiaFilterOperation
RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
list->append(referenceFilterValue);
referenceFilterValue->append(primitiveValueCache()->createValue(value->string, CSSPrimitiveValue::CSS_STRING));
- } else {
+ } else {
const CSSParserString name = value->function->name;
unsigned maximumArgumentCount = 1;
filterInfoForName(name, filterType, maximumArgumentCount);
-
+
if (filterType == WebKitCSSFilterValue::UnknownFilterOperation)
return 0;
// Create the new WebKitCSSFilterValue for this operation and add it to our list.
RefPtr<WebKitCSSFilterValue> filterValue = WebKitCSSFilterValue::create(filterType);
list->append(filterValue);
-
+
CSSParserValue* argument = args->current();
unsigned argumentCount = 0;
} else
return false;
}
-
+
if (!lineBoxContain)
return false;
property->m_value = CSSValueList::createCommaSeparated();
static_cast<CSSValueList*>(property->value())->append(value.release());
} else if (id == CSSPropertyFontFamily && (!property->value()->isValueList() || static_cast<CSSValueList*>(property->value())->length() != 1)) {
- // Unlike font-family property, font-family descriptor in @font-face rule
+ // Unlike font-family property, font-family descriptor in @font-face rule
// has to be a value list with exactly one family name. It cannot have a
// have 'initial' value and cannot 'inherit' from parent.
// See http://dev.w3.org/csswg/css3-fonts/#font-family-desc
PassRefPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
PassRefPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
void parseFillPosition(CSSParserValueList*, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-
+
void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
private:
void setStyleSheet(CSSStyleSheet*);
-
+
void recheckAtKeyword(const UChar* str, int len);
void setupParser(const char* prefix, const String&, const char* suffix);
static bool validUnit(CSSParserValue*, Units, bool strict);
bool parseBorderImageQuad(Units, RefPtr<CSSPrimitiveValue>&);
-
+
PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
#include "CSSSelectorList.h"
namespace WebCore {
-
+
using namespace WTF;
CSSParserValueList::~CSSParserValueList()
}
void CSSParserValueList::deleteValueAt(unsigned i)
-{
+{
m_values.remove(i);
}
parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitiveValue::CSS_EMS);
return parsedValue;
}
-
+
CSSParserSelector::CSSParserSelector()
: m_selector(adoptPtr(fastNew<CSSSelector>()))
{
Q_EMS = 0x100002
};
int unit;
-
-
+
+
PassRefPtr<CSSValue> createCSSValue();
};
{
}
~CSSParserValueList();
-
+
void addValue(const CSSParserValue&);
void insertValueAt(unsigned, const CSSParserValue&);
void deleteValueAt(unsigned);
}
CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values[i] : 0; }
-
+
void clear() { m_values.clear(); }
private:
~CSSParserSelector();
PassOwnPtr<CSSSelector> releaseSelector() { return m_selector.release(); }
-
+
void setTag(const QualifiedName& value) { m_selector->setTag(value); }
void setValue(const AtomicString& value) { m_selector->setValue(value); }
void setAttribute(const QualifiedName& value) { m_selector->setAttribute(value); }
double result = getDoubleValue() * factor;
if (!applyZoomMultiplier || multiplier == 1.0)
return result;
-
+
// Any original result that was >= 1 should not be allowed to fall below 1. This keeps border lines from
// vanishing.
double zoomedResult = result * multiplier;
void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionCode& ec)
{
- // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
+ // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
// No other engine supports mutating style through this API. Computed style is always read-only anyway.
// Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
ec = NO_MODIFICATION_ALLOWED_ERR;
void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionCode& ec)
{
- // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
+ // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
// No other engine supports mutating style through this API. Computed style is always read-only anyway.
// Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
ec = NO_MODIFICATION_ALLOWED_ERR;
CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
CSS_UNICODE_RANGE = 102,
-
+
// These next types are just used internally to allow us to translate back and forth from CSSPrimitiveValues to CSSParserValues.
CSS_PARSER_OPERATOR = 103,
CSS_PARSER_INTEGER = 104,
CSS_PARSER_HEXCOLOR = 105,
-
- // This is used internally for unknown identifiers
+
+ // This is used internally for unknown identifiers
CSS_PARSER_IDENTIFIER = 106,
-
+
// These are from CSS3 Values and Units, but that isn't a finished standard yet
CSS_TURN = 107,
CSS_REMS = 108,
// This is used by the CSS Exclusions draft
CSS_SHAPE = 110,
-
+
// Used by border images.
CSS_QUAD = 111
};
-
+
// This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
enum UnitCategory {
UNumber,
static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(new CSSPrimitiveValue(rgbValue)); }
static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
-
+
template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value)
{
return adoptRef(new CSSPrimitiveValue(value));
// use with care!!!
void setPrimitiveType(unsigned short type) { m_type = type; }
-
+
double getDoubleValue(unsigned short unitType, ExceptionCode&) const;
double getDoubleValue(unsigned short unitType) const;
double getDoubleValue() const { return m_value.num; }
Quad* getQuadValue(ExceptionCode&) const;
Quad* getQuadValue() const { return m_type != CSS_QUAD ? 0 : m_value.quad; }
-
+
PassRefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const;
RGBA32 getRGBA32Value() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; }
// Just because it is common.
if (rgbValue == Color::black)
return m_colorBlack;
-
+
// Just wipe out the cache and start rebuilding if it gets too big.
const int maximumColorCacheSize = 512;
if (m_colorValueCache.size() > maximumColorCacheSize)
int intValue = static_cast<int>(value);
if (value != intValue)
return CSSPrimitiveValue::create(value, type);
-
+
IntegerValueCache* cache;
switch (type) {
case CSSPrimitiveValue::CSS_PX:
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+
#ifndef CSSPrimitiveValueCache_h
#define CSSPrimitiveValueCache_h
#include <wtf/RefPtr.h>
namespace WebCore {
-
+
class CSSPrimitiveValueCache : public RefCounted<CSSPrimitiveValueCache> {
public:
static PassRefPtr<CSSPrimitiveValueCache> create() { return adoptRef(new CSSPrimitiveValueCache); }
PassRefPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
PassRefPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
template<typename T> static PassRefPtr<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
-
+
private:
CSSPrimitiveValueCache();
RefPtr<CSSPrimitiveValue> m_colorTransparent;
RefPtr<CSSPrimitiveValue> m_colorWhite;
RefPtr<CSSPrimitiveValue> m_colorBlack;
-
+
typedef HashMap<int, RefPtr<CSSPrimitiveValue> > IntegerValueCache;
RefPtr<CSSPrimitiveValue> m_pixelZero;
RefPtr<CSSPrimitiveValue> m_percentZero;
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
m_value.ident = CSSValueSubpixelAntialiased;
return;
}
-
+
ASSERT_NOT_REACHED();
m_value.ident = CSSValueAuto;
}
case CSSValueSubpixelAntialiased:
return SubpixelAntialiased;
}
-
+
ASSERT_NOT_REACHED();
return AutoSmoothing;
}
break;
}
}
-
+
template<> inline CSSPrimitiveValue::operator Order() const
{
switch (m_value.ident) {
return VE_NONE;
}
}
-
+
#endif
}
// Left = Start, Right = End, Before = Top, After = Bottom
return properties[logicalSide];
}
-
+
if (writingMode == BottomToTopWritingMode) {
// Start = Left, End = Right, Before = Bottom, After = Top.
switch (logicalSide) {
return properties[TopSide];
}
}
-
+
if (writingMode == LeftToRightWritingMode) {
// Start = Top, End = Bottom, Before = Left, After = Right.
switch (logicalSide) {
return properties[RightSide];
}
}
-
+
// Start = Top, End = Bottom, Before = Right, After = Left
switch (logicalSide) {
case StartSide:
return properties[BottomSide];
}
}
-
+
if (writingMode == BottomToTopWritingMode) {
// Start = Right, End = Left, Before = Bottom, After = Top
switch (logicalSide) {
return properties[TopSide];
}
}
-
+
if (writingMode == LeftToRightWritingMode) {
// Start = Bottom, End = Top, Before = Left, After = Right
switch (logicalSide) {
return properties[RightSide];
}
}
-
+
// Start = Bottom, End = Top, Before = Right, After = Left
switch (logicalSide) {
case StartSide:
return properties[logicalSide];
return logicalSide == LogicalWidth ? properties[1] : properties[0];
}
-
+
int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction, WritingMode writingMode)
{
switch (static_cast<CSSPropertyID>(propertyID)) {
bool isImplicit() const { return m_implicit; }
CSSValue* value() const { return m_value.get(); }
-
+
String cssText() const;
static int resolveDirectionAwareProperty(int propertyID, TextDirection, WritingMode);
CSSPropertyWebkitTransformOriginY
};
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitTransformOrigin, transformOriginProperties);
-
+
static const int textEmphasisProperties[] = {
CSSPropertyWebkitTextEmphasisColor,
CSSPropertyWebkitTextEmphasisStyle
};
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitTextEmphasis, textEmphasisProperties);
-
+
#undef SET_SHORTHAND_MAP_ENTRY
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
default:
break;
}
-
+
result += m_offset->cssText() + " ";
if (m_mask)
result += m_mask->cssText();
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSReflectValue_h
}
virtual bool isReflectValue() const { return true; }
-
+
CSSReflectionDirection m_direction;
RefPtr<CSSPrimitiveValue> m_offset;
RefPtr<CSSValue> m_mask;
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSReflectionDirection_h
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSSegmentedFontFace_h
namespace WebCore {
using namespace HTMLNames;
-
+
void CSSSelector::createRareData()
{
- if (m_hasRareData)
+ if (m_hasRareData)
return;
// Move the value to the rare data stucture.
m_data.m_rareData = new RareData(adoptRef(m_data.m_value));
case PseudoAnimatingFullScreenTransition:
return ANIMATING_FULL_SCREEN_TRANSITION;
#endif
-
+
case PseudoInputListButton:
#if ENABLE(DATALIST)
return INPUT_LIST_BUTTON;
return str;
}
-void CSSSelector::setAttribute(const QualifiedName& value)
-{
- createRareData();
- m_data.m_rareData->m_attribute = value;
+void CSSSelector::setAttribute(const QualifiedName& value)
+{
+ createRareData();
+ m_data.m_rareData->m_attribute = value;
}
-
-void CSSSelector::setArgument(const AtomicString& value)
-{
- createRareData();
- m_data.m_rareData->m_argument = value;
+
+void CSSSelector::setArgument(const AtomicString& value)
+{
+ createRareData();
+ m_data.m_rareData->m_argument = value;
}
-
+
void CSSSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList)
{
- createRareData();
+ createRareData();
m_data.m_rareData->m_selectorList = selectorList;
}
if (m_value)
m_value->deref();
}
-
+
// a helper function for parsing nth-arguments
bool CSSSelector::RareData::parseNth()
{
String argument = m_argument.lower();
-
+
if (argument.isEmpty())
return false;
-
+
m_a = 0;
m_b = 0;
if (argument == "odd") {
m_a = 1; // n == 1n
else
m_a = argument.substring(0, n).toInt();
-
+
size_t p = argument.find('+', n);
if (p != notFound)
m_b = argument.substring(p + 1, argument.length() - p - 1).toInt();
static bool isUnknownPseudoType(const AtomicString&);
static PseudoId pseudoId(PseudoType);
- // Selectors are kept in an array by CSSSelectorList. The next component of the selector is
+ // Selectors are kept in an array by CSSSelectorList. The next component of the selector is
// the next item in the array.
CSSSelector* tagHistory() const { return m_isLastInTagHistory ? 0 : const_cast<CSSSelector*>(this + 1); }
bool hasTag() const { return m_tag != anyQName(); }
-
+
const QualifiedName& tag() const { return m_tag; }
// AtomicString is really just an AtomicStringImpl* so the cast below is safe.
// FIXME: Perhaps call sites could be changed to accept AtomicStringImpl?
void setAttribute(const QualifiedName&);
void setArgument(const AtomicString&);
void setSelectorList(PassOwnPtr<CSSSelectorList>);
-
+
bool parseNth();
bool matchNth(int count);
unsigned m_relation : 3; // enum Relation
mutable unsigned m_match : 4; // enum Match
mutable unsigned m_pseudoType : 8; // PseudoType
-
+
private:
- bool m_parsedNth : 1; // Used for :nth-*
+ bool m_parsedNth : 1; // Used for :nth-*
bool m_isLastInSelectorList : 1;
bool m_isLastInTagHistory : 1;
bool m_hasRareData : 1;
OwnPtr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not
};
void createRareData();
-
+
union DataUnion {
DataUnion() : m_value(0) { }
AtomicStringImpl* m_value;
RareData* m_rareData;
} m_data;
-
+
QualifiedName m_tag;
};
inline const QualifiedName& CSSSelector::attribute() const
-{
+{
ASSERT(isAttributeSelector());
ASSERT(m_hasRareData);
return m_data.m_rareData->m_attribute;
}
-
-inline bool CSSSelector::matchesPseudoElement() const
-{
+
+inline bool CSSSelector::matchesPseudoElement() const
+{
if (m_pseudoType == PseudoUnknown)
extractPseudoType();
return m_match == PseudoElement;
m_data.m_value->ref();
}
-inline void move(PassOwnPtr<CSSSelector> from, CSSSelector* to)
+inline void move(PassOwnPtr<CSSSelector> from, CSSSelector* to)
{
memcpy(to, from.get(), sizeof(CSSSelector));
// We want to free the memory (which was allocated with fastNew), but we
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
namespace WebCore {
-CSSSelectorList::~CSSSelectorList()
+CSSSelectorList::~CSSSelectorList()
{
deleteSelectors();
}
-
+
void CSSSelectorList::adopt(CSSSelectorList& list)
{
deleteSelectors();
deleteSelectors();
const size_t vectorSize = selectorVector.size();
size_t flattenedSize = 0;
- for (size_t i = 0; i < vectorSize; ++i) {
+ for (size_t i = 0; i < vectorSize; ++i) {
for (CSSParserSelector* selector = selectorVector[i].get(); selector; selector = selector->tagHistory())
++flattenedSize;
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSSelectorList_h
#include "CSSSelector.h"
namespace WebCore {
-
+
class CSSParserSelector;
-
+
class CSSSelectorList {
WTF_MAKE_NONCOPYABLE(CSSSelectorList); WTF_MAKE_FAST_ALLOCATED;
public:
void adopt(CSSSelectorList& list);
void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
-
+
CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; }
static CSSSelector* next(CSSSelector*);
bool hasOneSelector() const { return m_selectorArray && !next(m_selectorArray); }
(selector->style()->*m_visitedLinkSetter)(selector->getColorFromPrimitiveValue(primitiveValue, true));
}
}
-
+
void applyColorValue(CSSStyleSelector* selector, const Color& color) const
{
if (selector->applyPropertyToRegularStyle())
String getPropertyPriority(const String& propertyName);
String getPropertyShorthand(const String& propertyName);
bool isPropertyImplicit(const String& propertyName);
-
+
virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const = 0;
virtual String getPropertyValue(int propertyID) const = 0;
virtual bool getPropertyPriority(int propertyID) const = 0;
virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const = 0;
virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable() = 0;
-
+
void diff(CSSMutableStyleDeclaration*) const;
PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;
m_style->set##Prop(m_parentStyle->prop()); \
return; \
}
-
+
#define HANDLE_INHERIT_COND_WITH_BACKUP(propID, prop, propAlt, Prop) \
if (id == propID) { \
if (m_parentStyle->prop().isValid()) \
unsigned position() const { return m_position; }
CSSStyleRule* rule() const { return m_rule; }
CSSSelector* selector() const { return m_selector; }
-
+
bool hasFastCheckableSelector() const { return m_hasFastCheckableSelector; }
bool hasMultipartSelector() const { return m_hasMultipartSelector; }
bool hasRightmostSelectorMatchingHTMLBasedOnRuleHash() const { return m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash; }
bool containsUncommonAttributeSelector() const { return m_containsUncommonAttributeSelector; }
unsigned specificity() const { return m_specificity; }
unsigned linkMatchType() const { return m_linkMatchType; }
-
+
// Try to balance between memory usage (there can be lots of RuleData objects) and good filtering performance.
static const unsigned maximumIdentifierCount = 4;
const unsigned* descendantSelectorIdentifierHashes() const { return m_descendantSelectorIdentifierHashes; }
-private:
+private:
CSSStyleRule* m_rule;
CSSSelector* m_selector;
unsigned m_specificity;
public:
RuleSet();
~RuleSet();
-
+
typedef HashMap<AtomicStringImpl*, Vector<RuleData>*> AtomRuleMap;
-
+
void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0);
void addStyleRule(CSSStyleRule* item);
void disableAutoShrinkToFit() { m_autoShrinkToFitEnabled = false; }
void collectFeatures(CSSStyleSelector::Features&) const;
-
+
const Vector<RuleData>* idRules(AtomicStringImpl* key) const { return m_idRules.get(key); }
const Vector<RuleData>* classRules(AtomicStringImpl* key) const { return m_classRules.get(key); }
const Vector<RuleData>* tagRules(AtomicStringImpl* key) const { return m_tagRules.get(key); }
const Vector<RuleData>* focusPseudoClassRules() const { return &m_focusPseudoClassRules; }
const Vector<RuleData>* universalRules() const { return &m_universalRules; }
const Vector<RuleData>* pageRules() const { return &m_pageRules; }
-
+
public:
AtomRuleMap m_idRules;
AtomRuleMap m_classRules;
static RuleSet* defaultPrintStyle;
static RuleSet* defaultViewSourceStyle;
static CSSStyleSheet* simpleDefaultStyleSheet;
-
+
static RuleSet* siblingRulesInDefaultStyle;
static RuleSet* uncommonAttributeRulesInDefaultStyle;
ASSERT(!siblingRulesInDefaultStyle);
#endif
}
-
+
static const MediaQueryEvaluator& screenEval()
{
DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen"));
StyleSheet* sheet = styleSheets->item(i);
if (sheet->isCSSStyleSheet() && !sheet->disabled())
m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(sheet), *m_medium, this);
- }
+ }
// Collect all ids and rules using sibling selectors (:first-child and similar)
// in the current set of stylesheets. Style sharing code uses this information to reject
// sharing candidates.
m_fontSelector->clearDocument();
deleteAllValues(m_viewportDependentMediaQueryResults);
}
-
-CSSStyleSelector::Features::Features()
+
+CSSStyleSelector::Features::Features()
: usesFirstLineRules(false)
, usesBeforeAfterRules(false)
, usesLinkRules(false)
{
ASSERT(!defaultStyle);
ASSERT(!simpleDefaultStyleSheet);
-
+
defaultStyle = new RuleSet;
// There are no media-specific rules in the simple default style.
defaultPrintStyle = defaultStyle;
simpleDefaultStyleSheet = parseUASheet(simpleUserAgentStyleSheet, strlen(simpleUserAgentStyleSheet));
defaultStyle->addRulesFromSheet(simpleDefaultStyleSheet, screenEval());
-
+
// No need to initialize quirks sheet yet as there are no quirk rules for elements allowed in simple default style.
}
-
+
static void loadViewSourceStyle()
{
ASSERT(!defaultViewSourceStyle);
assertNoSiblingRulesInDefaultStyle();
collectSpecialRulesInDefaultStyle();
}
-
+
#if ENABLE(SVG)
static bool loadedSVGUserAgentSheet;
if (element->isSVGElement() && !loadedSVGUserAgentSheet) {
collectSpecialRulesInDefaultStyle();
}
#endif
-
+
#if ENABLE(MATHML)
static bool loadedMathMLUserAgentSheet;
if (element->isMathMLElement() && !loadedMathMLUserAgentSheet) {
collectSpecialRulesInDefaultStyle();
}
#endif
-
+
#if ENABLE(VIDEO)
static bool loadedMediaStyleSheet;
if (!loadedMediaStyleSheet && (element->hasTagName(videoTag) || element->hasTagName(audioTag))) {
collectSpecialRulesInDefaultStyle();
}
#endif
-
+
#if ENABLE(FULLSCREEN_API)
static bool loadedFullScreenStyleSheet;
if (!loadedFullScreenStyleSheet && element->document()->webkitIsFullScreen()) {
if (!rules || !m_element)
return;
-
+
// We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer.
if (m_element->hasID())
matchRulesForList(rules->focusPseudoClassRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules);
matchRulesForList(rules->tagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);
matchRulesForList(rules->universalRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules);
-
+
// If we didn't match any rules, we're done.
if (m_matchedRules.isEmpty())
return;
-
+
// Sort the set of matched rules.
sortMatchedRules();
-
+
// Now transfer the set of matched rules over to our list of decls.
if (!m_checker.isCollectingRulesOnly()) {
// FIXME: This sucks, the inspector should get the style from the visited style itself.
if (!decl || (!decl->length() && !includeEmptyRules))
continue;
if (m_sameOriginOnly && !m_checker.document()->securityOrigin()->canRequest(rule->baseURL()))
- continue;
- // If we're matching normal rules, set a pseudo bit if
+ continue;
+ // If we're matching normal rules, set a pseudo bit if
// we really just matched a pseudo-element.
if (m_dynamicPseudo != NOPSEUDO && m_checker.pseudoStyle() == NOPSEUDO) {
if (m_checker.isCollectingRulesOnly())
{
unsigned specificity1 = r1->specificity();
unsigned specificity2 = r2->specificity();
- return (specificity1 == specificity2) ? r1->position() < r2->position() : specificity1 < specificity2;
+ return (specificity1 == specificity2) ? r1->position() < r2->position() : specificity1 < specificity2;
}
void CSSStyleSelector::sortMatchedRules()
{
std::sort(m_matchedRules.begin(), m_matchedRules.end(), compareRules);
}
-
+
inline void CSSStyleSelector::initElement(Element* e)
{
if (m_element != e) {
if (element->hasTagName(progressTag)) {
if (!m_element->hasTagName(progressTag))
return false;
-
+
HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
return false;
-
+
return true;
}
#endif
-
+
HTMLInputElement* thisInputElement = element->toInputElement();
HTMLInputElement* otherInputElement = m_element->toInputElement();
-
+
if (!thisInputElement || !otherInputElement)
return false;
-
+
if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
return false;
if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
return false;
if (thisInputElement->required() != otherInputElement->required())
return false;
-
+
if (element->isEnabledFormControl() != m_element->isEnabledFormControl())
return false;
-
+
if (element->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())
return false;
if (!m_element->document()->containsValidityStyleRules())
return false;
-
+
bool willValidate = element->willValidate();
-
+
if (willValidate != m_element->willValidate())
return false;
-
+
if (willValidate && (element->isValidFormControlElement() != m_element->isValidFormControlElement()))
return false;
-
+
if (element->isInRange() != m_element->isInRange())
return false;
-
+
if (element->isOutOfRange() != m_element->isOutOfRange())
return false;
-
+
return true;
}
return true;
}
-
+
inline Node* CSSStyleSelector::findSiblingForStyleSharing(Node* node, unsigned& count) const
{
for (; node; node = node->previousSibling()) {
static inline bool parentStylePreventsSharing(const RenderStyle* parentStyle)
{
- return parentStyle->childrenAffectedByPositionalRules()
+ return parentStyle->childrenAffectedByPositionalRules()
|| parentStyle->childrenAffectedByFirstChildRules()
|| parentStyle->childrenAffectedByLastChildRules();
}
// In quirks mode, we match rules from the quirks user agent sheet.
if (!m_checker.strictParsing())
matchRules(defaultQuirksStyle, firstUARule, lastUARule, false);
-
+
// If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet.
if (m_checker.document()->isViewSource()) {
if (!defaultViewSourceStyle)
documentStyle->setFontDescription(fontDescription);
documentStyle->font().update(0);
-
+
return documentStyle.release();
}
addMatchedDeclaration(textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration());
}
}
-
+
// 6. Check the rules in author sheets next.
if (m_matchAuthorAndUserStyles)
matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule, false);
}
}
}
-
+
// Now we have all of the matched rules in the appropriate order. Walk the rules and apply
// high-priority properties first, i.e., those properties that other properties depend on.
// The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
applyDeclarations<true>(true, firstUserRule, lastUserRule);
}
applyDeclarations<true>(true, firstUARule, lastUARule);
-
+
// If our font got dirtied, go ahead and update it now.
updateFont();
// Now do the normal priority UA properties.
applyDeclarations<false>(false, firstUARule, lastUARule);
-
+
// Cache our border and background so that we can examine them later.
cacheBorderAndBackground();
-
+
// Now do the author and user normal priority properties and all the !important properties.
if (!resolveForRootDefault) {
applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1);
applyDeclarations<false>(true, firstUARule, lastUARule);
ASSERT(!m_fontDirty);
- // If our font got dirtied by one of the non-essential font props,
+ // If our font got dirtied by one of the non-essential font props,
// go ahead and update it a second time.
updateFont();
void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* elementStyle, KeyframeList& list)
{
list.clear();
-
+
// Get the keyframesRule for this name
if (!e || list.animationName().isEmpty())
return;
m_keyframesRuleMap.checkConsistency();
-
+
if (!m_keyframesRuleMap.contains(list.animationName().impl()))
return;
-
+
const WebKitCSSKeyframesRule* rule = m_keyframesRuleMap.find(list.animationName().impl()).get()->second.get();
-
+
// Construct and populate the style for each keyframe
for (unsigned i = 0; i < rule->length(); ++i) {
// Apply the declaration to the style. This is a simplified version of the logic in styleForElement
initElement(e);
initForStyleResolve(e);
-
+
const WebKitCSSKeyframeRule* keyframeRule = rule->item(i);
KeyframeValue keyframe(0, 0);
list.insert(keyframe);
}
}
-
+
// If the 0% keyframe is missing, create it (but only if there is at least one other keyframe)
int initialListSize = list.size();
if (initialListSize > 0 && list[0].key() != 0) {
initForStyleResolve(e, parentStyle, pseudo);
m_style = RenderStyle::create();
-
+
if (m_parentStyle)
m_style->inheritFrom(m_parentStyle);
// Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
// those rules.
-
+
// Check UA, user and author rules.
int firstUARule = -1, lastUARule = -1, firstUserRule = -1, lastUserRule = -1, firstAuthorRule = -1, lastAuthorRule = -1;
matchUARules(firstUARule, lastUARule);
return 0;
m_style->setStyleType(pseudo);
-
+
m_lineHeightValue = 0;
// High-priority properties.
applyDeclarations<true>(true, firstAuthorRule, lastAuthorRule);
applyDeclarations<true>(true, firstUserRule, lastUserRule);
applyDeclarations<true>(true, firstUARule, lastUARule);
-
+
// If our font got dirtied, go ahead and update it now.
updateFont();
// Line-height is set when we are sure we decided on the font-size
if (m_lineHeightValue)
applyProperty(CSSPropertyLineHeight, m_lineHeightValue);
-
+
// Now do the normal priority properties.
applyDeclarations<false>(false, firstUARule, lastUARule);
-
+
// Cache our border and background so that we can examine them later.
cacheBorderAndBackground();
-
+
applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1);
applyDeclarations<false>(true, firstAuthorRule, lastAuthorRule);
applyDeclarations<false>(true, firstUserRule, lastUserRule);
applyDeclarations<false>(true, firstUARule, lastUARule);
-
- // If our font got dirtied by one of the non-essential font props,
+
+ // If our font got dirtied by one of the non-essential font props,
// go ahead and update it a second time.
updateFont();
// Start loading images referenced by this style.
loadPendingImages();
-
+
// Now return the style.
return m_style.release();
}
{
// Intrinsic margin value.
const int intrinsicMargin = 2 * style->effectiveZoom();
-
+
// FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
// FIXME: Using "quirk" to decide the margin wasn't set is kind of lame.
if (style->width().isIntrinsicOrAuto()) {
else
style->setDisplay(BLOCK);
}
-
+
// FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
// clear how that should work.
if (style->display() == INLINE && style->styleType() == NOPSEUDO && parentStyle && style->writingMode() != parentStyle->writingMode())
style->setDisplay(INLINE_BLOCK);
-
+
// After performing the display mutation, check table rows. We do not honor position:relative on
// table rows or cells. This has been established in CSS2.1 (and caused a crash in containingBlock()
// on some sites).
// Auto z-index becomes 0 for the root element and transparent objects. This prevents
// cases where objects that should be blended as a single unit end up with a non-transparent
// object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
- if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f ||
- style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect()))
+ if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f
+ || style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect()))
style->setZIndex(0);
// Textarea considers overflow visible as auto.
style->setTextDecorationsInEffect(style->textDecoration());
else
style->addToTextDecorationsInEffect(style->textDecoration());
-
+
// If either overflow value is not visible, change to auto.
if (style->overflowX() == OMARQUEE && style->overflowY() != OMARQUEE)
style->setOverflowY(OMARQUEE);
// FIXME: Eventually table sections will support auto and scroll.
if (style->display() == TABLE || style->display() == INLINE_TABLE ||
style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {
- if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
+ if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
style->setOverflowX(OVISIBLE);
- if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
+ if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
style->setOverflowY(OVISIBLE);
}
}
m_checker.setCollectingRulesOnly(false);
-
+
return m_ruleList.release();
}
selector = selector->tagHistory();
};
- for (selector = selector->tagHistory(); selector; selector = selector->tagHistory()) {
+ for (selector = selector->tagHistory(); selector; selector = selector->tagHistory()) {
if (selector->isAttributeSelector())
return true;
if (selectorListContainsUncommonAttributeSelector(selector))
}
RuleSet::~RuleSet()
-{
+{
deleteAllValues(m_idRules);
deleteAllValues(m_classRules);
deleteAllValues(m_shadowPseudoElementRules);
addRule(rule, s);
}
}
-
+
static inline void collectFeaturesFromSelector(CSSStyleSelector::Features& features, const CSSSelector* selector)
{
if (selector->m_match == CSSSelector::Id && !selector->value().isEmpty())
if (foundSiblingSelector) {
if (!features.siblingRules)
features.siblingRules = adoptPtr(new RuleSet);
- features.siblingRules->addRule(ruleData.rule(), ruleData.selector());
+ features.siblingRules->addRule(ruleData.rule(), ruleData.selector());
}
if (ruleData.containsUncommonAttributeSelector()) {
if (!features.uncommonAttributeRules)
features.uncommonAttributeRules = adoptPtr(new RuleSet);
- features.uncommonAttributeRules->addRule(ruleData.rule(), ruleData.selector());
+ features.uncommonAttributeRules->addRule(ruleData.rule(), ruleData.selector());
}
}
}
collectFeaturesFromList(features, m_focusPseudoClassRules);
collectFeaturesFromList(features, m_universalRules);
}
-
+
static inline void shrinkMapVectorsToFit(RuleSet::AtomRuleMap& map)
{
RuleSet::AtomRuleMap::iterator end = map.end();
for (RuleSet::AtomRuleMap::iterator it = map.begin(); it != end; ++it)
it->second->shrinkToFit();
}
-
+
void RuleSet::shrinkToFit()
{
shrinkMapVectorsToFit(m_idRules);
*ok = false;
} else {
int type = primitiveValue->primitiveType();
-
+
if (!style && (type == CSSPrimitiveValue::CSS_EMS || type == CSSPrimitiveValue::CSS_EXS || type == CSSPrimitiveValue::CSS_REMS)) {
if (ok)
*ok = false;
}
return l;
}
-
+
static Length convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0)
{
return convertToLength(primitiveValue, style, rootStyle, false, multiplier, ok);
{
return convertToLength(primitiveValue, style, rootStyle, true, multiplier, ok);
}
-
+
template <bool applyFirst>
void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclaration, bool isImportant)
{
CSSMutableStyleDeclaration::const_iterator end = styleDeclaration->end();
for (CSSMutableStyleDeclaration::const_iterator it = styleDeclaration->begin(); it != end; ++it) {
const CSSProperty& current = *it;
-
+
if (isImportant != current.isImportant())
continue;
-
+
int property = current.id();
-
+
if (applyFirst) {
COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 16, CSS_zoom_is_end_of_first_prop_range);
COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
-
+
// give special priority to font-xxx, color properties, etc
if (property > CSSPropertyLineHeight)
continue;
m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;
m_applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;
- applyDeclaration<applyFirst>(styleDeclaration, isImportant);
+ applyDeclaration<applyFirst>(styleDeclaration, isImportant);
}
m_applyPropertyToRegularStyle = true;
m_applyPropertyToVisitedLinkStyle = false;
return;
}
- for (int i = startIndex; i <= endIndex; ++i)
+ for (int i = startIndex; i <= endIndex; ++i)
applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration, isImportant);
}
CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0;
float zoomFactor = m_style->effectiveZoom();
-
+
// What follows is a list that maps the CSS properties into their corresponding front-end
// RenderStyle values. Shorthands (e.g. border, background) occur in this list as well and
// are only hit when mapping "inherit" or "initial" into front-end values.
case CSSPropertyTableLayout:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(tableLayout, TableLayout)
return;
- case CSSPropertyUnicodeBidi:
+ case CSSPropertyUnicodeBidi:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(unicodeBidi, UnicodeBidi)
return;
- case CSSPropertyTextTransform:
+ case CSSPropertyTextTransform:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textTransform, TextTransform)
return;
case CSSPropertyVisibility:
r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
} else
r = *primitiveValue;
-
+
m_style->setResize(r);
return;
}
fontDescription.setKeywordSize(0);
float oldSize = 0;
float size = 0;
-
+
bool parentIsAbsoluteSize = false;
if (m_parentNode) {
oldSize = m_parentStyle->fontDescription().specifiedSize();
return;
}
- fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize &&
- (primitiveValue->getIdent() == CSSValueLarger ||
- primitiveValue->getIdent() == CSSValueSmaller));
+ fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
+ && (primitiveValue->getIdent() == CSSValueLarger
+ || primitiveValue->getIdent() == CSSValueSmaller));
} else {
int type = primitiveValue->primitiveType();
- fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize ||
- (type != CSSPrimitiveValue::CSS_PERCENTAGE &&
- type != CSSPrimitiveValue::CSS_EMS &&
- type != CSSPrimitiveValue::CSS_EXS &&
- type != CSSPrimitiveValue::CSS_REMS));
+ fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
+ || (type != CSSPrimitiveValue::CSS_PERCENTAGE
+ && type != CSSPrimitiveValue::CSS_EMS
+ && type != CSSPrimitiveValue::CSS_EXS
+ && type != CSSPrimitiveValue::CSS_REMS));
if (CSSPrimitiveValue::isUnitTypeLength(type))
size = primitiveValue->computeLength<float>(m_parentStyle, m_rootElementStyle, 1.0, true);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
}
m_style->setClip(top, right, bottom, left);
m_style->setHasClip(hasClip);
-
+
// rect, ident
return;
}
m_style->clearContent();
return;
}
-
+
if (!value->isValueList())
return;
setFontDescription(fontDescription);
return;
}
-
+
if (!value->isValueList())
return;
FontDescription fontDescription = m_style->fontDescription();
} else if (primitiveValue) {
m_style->setLineHeight(RenderStyle::initialLineHeight());
m_lineHeightValue = 0;
-
+
FontDescription fontDescription;
RenderTheme::defaultTheme()->systemFont(primitiveValue->getIdent(), fontDescription);
return;
fontDescription.setRenderingMode(settings->fontRenderingMode());
fontDescription.setUsePrinterFont(m_checker.document()->printing());
-
+
// Handle the zoom factor.
fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.document(), m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules()));
setFontDescription(fontDescription);
image.setOutset(LengthBox());
else
image.setOutset(mapNinePieceImageQuad(value));
-
+
if (isBorderImage)
m_style->setBorderImage(image);
else
image.setVerticalRule(StretchImageRule);
} else
mapNinePieceImageRepeat(value, image);
-
+
if (isBorderImage)
m_style->setBorderImage(image);
else
image.setFill(false);
} else
mapNinePieceImageSlice(value, image);
-
+
if (isBorderImage)
m_style->setBorderImage(image);
else
m_style->setBoxReflect(RenderStyle::initialBoxReflect());
return;
}
-
+
if (!value->isReflectValue())
return;
mask.setMaskDefaults();
mapNinePieceImage(property, reflectValue->mask(), mask);
reflection->setMask(mask);
-
+
m_style->setBoxReflect(reflection.release());
return;
}
return;
}
case CSSPropertyWebkitMarqueeSpeed: {
- HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed)
+ HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed)
if (!primitiveValue)
return;
if (primitiveValue->getIdent()) {
return;
}
case CSSPropertyWebkitMarqueeStyle:
- HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior)
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior)
return;
case CSSPropertyWebkitFlowInto:
HANDLE_INHERIT_AND_INITIAL(flowThread, FlowThread);
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)
return;
case CSSPropertyWebkitUserDrag:
- HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userDrag, UserDrag)
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userDrag, UserDrag)
return;
case CSSPropertyWebkitUserModify:
- HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userModify, UserModify)
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userModify, UserModify)
return;
case CSSPropertyWebkitUserSelect:
- HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userSelect, UserSelect)
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userSelect, UserSelect)
return;
case CSSPropertyTextOverflow: {
DashboardRegion *region = primitiveValue->getDashboardRegionValue();
if (!region)
return;
-
+
DashboardRegion *first = region;
while (region) {
Length top = convertToIntLength(region->top(), style(), m_rootElementStyle);
m_style->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true);
region = region->m_next.get();
}
-
+
m_element->document()->setHasDashboardRegions(true);
-
+
return;
}
-#endif
+#endif
case CSSPropertyWebkitRtlOrdering:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(rtlOrdering, RTLOrdering)
return;
m_style->setPerspective(0);
return;
}
-
+
float perspectiveValue;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
m_style->setLineBoxContain(LineBoxContainNone);
return;
}
-
+
if (!value->isCSSLineBoxContainValue())
return;
-
+
CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value);
m_style->setLineBoxContain(lineBoxContainValue->value());
return;
}
-
+
case CSSPropertyWebkitWrapShape:
HANDLE_INHERIT_AND_INITIAL(wrapShape, WrapShape);
if (!primitiveValue)
return;
-
+
if (primitiveValue->getIdent() == CSSValueAuto)
m_style->setWrapShape(0);
else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_SHAPE)
layer->setComposite(FillLayer::initialFillComposite(layer->type()));
return;
}
-
+
if (!value->isPrimitiveValue())
return;
layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
return;
}
-
+
if (!value->isPrimitiveValue())
return;
layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
return;
}
-
+
if (!value->isPrimitiveValue())
return;
layer->setSizeType(Cover);
else
layer->setSizeType(SizeLength);
-
+
LengthSize b = FillLayer::initialFillSizeLength(layer->type());
-
+
if (value->cssValueType() == CSSValue::CSS_INITIAL || primitiveValue->getIdent() == CSSValueContain
|| primitiveValue->getIdent() == CSSValueCover) {
layer->setSizeLength(b);
CSSPrimitiveValue* first = pair ? static_cast<CSSPrimitiveValue*>(pair->first()) : primitiveValue;
CSSPrimitiveValue* second = pair ? static_cast<CSSPrimitiveValue*>(pair->second()) : 0;
-
+
Length firstLength, secondLength;
int firstType = first->primitiveType();
int secondType = second ? second->primitiveType() : 0;
secondLength = Length(second->getDoubleValue(), Percent);
else
return;
-
+
b.setWidth(firstLength);
b.setHeight(secondLength);
layer->setSizeLength(b);
layer->setXPosition(FillLayer::initialFillXPosition(layer->type()));
return;
}
-
+
if (!value->isPrimitiveValue())
return;
layer->setYPosition(FillLayer::initialFillYPosition(layer->type()));
return;
}
-
+
if (!value->isPrimitiveValue())
return;
float zoomFactor = m_style->effectiveZoom();
-
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Length l;
int type = primitiveValue->primitiveType();
animation->setTimingFunction(Animation::initialAnimationTimingFunction());
return;
}
-
+
if (value->isPrimitiveValue()) {
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
switch (primitiveValue->getIdent()) {
}
return;
}
-
+
if (value->isTimingFunctionValue()) {
CSSTimingFunctionValue* timingFunction = static_cast<CSSTimingFunctionValue*>(value);
if (timingFunction->isCubicBezierTimingFunctionValue()) {
// Retrieve the border image value.
CSSBorderImageValue* borderImage = static_cast<CSSBorderImageValue*>(value);
-
+
// Set the image (this kicks off the load).
CSSPropertyID imageProperty;
if (property == CSSPropertyWebkitBorderImage || property == CSSPropertyBorderImage)
imageProperty = CSSPropertyWebkitMaskBoxImageSource;
else
imageProperty = property;
-
+
if (CSSValue* imageValue = borderImage->imageValue())
image.setImage(styleImage(imageProperty, imageValue));
// Map in the border slices.
if (borderImage->m_borderSlice)
image.setBorderSlices(mapNinePieceImageQuad(borderImage->m_borderSlice.get()));
-
+
// Map in the outset.
if (borderImage->m_outset)
image.setOutset(mapNinePieceImageQuad(borderImage->m_outset.get()));
{
if (!value || !value->isPrimitiveValue())
return;
-
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Pair* pair = primitiveValue->getPairValue();
if (!pair || !pair->first() || !pair->second())
{
if (m_style->textSizeAdjust())
return;
-
+
FontDescription newFontDescription(m_style->fontDescription());
newFontDescription.setComputedSize(newFontDescription.specifiedSize());
m_style->setFontDescription(newFontDescription);
{
if (style->effectiveZoom() == parentStyle->effectiveZoom())
return;
-
+
const FontDescription& childFont = style->fontDescription();
FontDescription newFontDescription(childFont);
setFontSize(newFontDescription, childFont.specifiedSize());
void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderStyle* parentStyle)
{
const FontDescription& childFont = style->fontDescription();
-
+
if (childFont.isAbsoluteSize() || !parentStyle)
return;
// With the smart minimum, we never want to get smaller than the minimum font size to keep fonts readable.
// However we always allow the page to set an explicit pixel size that is smaller,
// since sites will mis-render otherwise (e.g., http://www.gamespot.com with a 9px minimum).
-
+
Settings* settings = document->settings();
if (!settings)
return 1.0f;
// doing so won't disrupt the layout.
if (useSmartMinimumForFontSize && zoomedSize < minLogicalSize && (specifiedSize >= minLogicalSize || !isAbsoluteSize))
zoomedSize = minLogicalSize;
-
+
// Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various
// platforms (I'm looking at you, Windows.)
return min(1000000.0f, zoomedSize);
int col = (keyword - CSSValueXxSmall);
return quirksMode ? quirksFontSizeTable[row][col] : strictFontSizeTable[row][col];
}
-
+
// Value is outside the range of the table. Apply the scale factor instead.
float minLogicalSize = max(settings->minimumLogicalFontSize(), 1);
return max(fontSizeFactors[keyword - CSSValueXxSmall]*mediumSize, minLogicalSize);
float CSSStyleSelector::largerFontSize(float size, bool) const
{
// FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
- // the next size level.
+ // the next size level.
return size * 1.2f;
}
float CSSStyleSelector::smallerFontSize(float size, bool) const
{
// FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
- // the next size level.
+ // the next size level.
return size / 1.2f;
}
}
if (haveNonPrimitiveValue)
continue;
-
+
CSSPrimitiveValue* firstValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(0));
-
+
switch (transformValue->operationType()) {
case WebKitCSSTransformValue::ScaleTransformOperation:
case WebKitCSSTransformValue::ScaleXTransformOperation:
double sy = 1.0;
if (transformValue->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
- else {
+ else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
sy = secondValue->getDoubleValue();
- } else
+ } else
sy = sx;
}
}
sz = firstValue->getDoubleValue();
else if (transformValue->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
- else {
+ else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 2) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
sy = secondValue->getDoubleValue();
- } else
+ } else
sy = sx;
}
}
Length ty = Length(0, Fixed);
if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok);
- else {
+ else {
tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok);
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 1) {
tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok);
else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok);
- else {
+ else {
tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok);
if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 2) {
angle = grad2deg(angle);
else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
angle = turn2deg(angle);
-
+
operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(transformValue->operationType())));
break;
}
angle = rad2deg(angle);
else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
angle = grad2deg(angle);
-
+
if (transformValue->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
x = 1;
else if (transformValue->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(15))->getDoubleValue());
operations.operations().append(Matrix3DTransformOperation::create(matrix));
break;
- }
+ }
case WebKitCSSTransformValue::PerspectiveTransformOperation: {
bool ok = true;
Length p = Length(0, Fixed);
ok = val >= 0;
p = Length(clampToPositiveInteger(val), Fixed);
}
-
+
if (!ok)
return false;
outOperations.clear();
return false;
}
-
+
float zoomFactor = style ? style->effectiveZoom() : 1;
FilterOperations operations;
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
{
if (m_pendingImageProperties.isEmpty())
return;
-
+
HashSet<int>::const_iterator end = m_pendingImageProperties.end();
for (HashSet<int>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
CSSPropertyID currentProperty = static_cast<CSSPropertyID>(*it);
CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader();
-
+
switch (currentProperty) {
case CSSPropertyBackgroundImage: {
for (FillLayer* backgroundLayer = m_style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets, const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets,
bool strictParsing, bool matchAuthorAndUserStyles);
~CSSStyleSelector();
-
+
// Using these during tree walk will allow style selector to optimize child and descendant selector lookups.
void pushParent(Element* parent) { m_checker.pushParent(parent); }
void popParent(Element* parent) { m_checker.popParent(parent); }
PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false);
-
+
void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0);
void setStyle(PassRefPtr<RenderStyle> s) { m_style = s; } // Used by the document when setting up its root style.
void applyPropertyToStyle(int id, CSSValue*, RenderStyle*);
-
+
static float getComputedSizeFromSpecifiedSize(Document*, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSmartMinimumForFontFize);
private:
void matchRulesForList(const Vector<RuleData>*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules);
bool fastRejectSelector(const RuleData&) const;
void sortMatchedRules();
-
+
bool checkSelector(const RuleData&);
template <bool firstPass>
bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); }
bool isFirstPage(int pageIndex) const;
String pageName(int pageIndex) const;
-
+
OwnPtr<RuleSet> m_authorStyle;
OwnPtr<RuleSet> m_userStyle;
StyleImage* styleImage(CSSPropertyID, CSSValue*);
StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
-
+
bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
Vector<const RuleData*, 32> m_matchedRules;
RefPtr<CSSRuleList> m_ruleList;
-
+
HashSet<int> m_pendingImageProperties; // Hash of CSSPropertyIDs
OwnPtr<MediaQueryEvaluator> m_medium;
bool m_fontDirty;
bool m_matchAuthorAndUserStyles;
bool m_sameOriginOnly;
-
+
RefPtr<CSSFontSelector> m_fontSelector;
Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
bool m_applyPropertyToRegularStyle;
bool m_applyPropertyToVisitedLinkStyle;
const CSSStyleApplyProperty& m_applyProperty;
-
+
friend class CSSStyleApplyProperty;
};
|| parentNode->hasTagName(HTMLNames::styleTag)
#if ENABLE(SVG)
|| parentNode->hasTagName(SVGNames::styleTag)
-#endif
+#endif
|| parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE;
}
#endif
CSSRule* c = r.get();
m_children.insert(index, r.release());
c->insertedIntoParent();
-
+
styleSheetChanged();
-
+
return index;
}
return;
m_namespaces = adoptPtr(new CSSNamespace(prefix, uri, m_namespaces.release()));
-
+
if (prefix.isEmpty())
// Set the default namespace on the parser so that selectors that omit namespace info will
// be able to pick it up easily.
while (StyleBase* parent = root->parent())
root = parent;
Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast<CSSStyleSheet*>(root)->document() : 0;
-
+
/* FIXME: We don't need to do everything updateStyleSelector does,
* basically we just need to recreate the document's selector with the
* already existing style sheets.
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSTimingFunctionValue_h
{
return adoptRef(new CSSLinearTimingFunctionValue);
}
-
+
private:
CSSLinearTimingFunctionValue()
{
virtual bool isLinearTimingFunctionValue() const { return true; }
};
-
+
class CSSCubicBezierTimingFunctionValue : public CSSTimingFunctionValue {
public:
static PassRefPtr<CSSCubicBezierTimingFunctionValue> create(double x1, double y1, double x2, double y2)
int numberOfSteps() const { return m_steps; }
bool stepAtStart() const { return m_stepAtStart; }
-
+
private:
CSSStepsTimingFunctionValue(int steps, bool stepAtStart)
: m_steps(steps)
int m_steps;
bool m_stepAtStart;
};
-
+
} // namespace
#endif
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CSSUnicodeRangeValue_h
found = true;
}
}
-
+
return found;
}
-
+
bool CSSValueList::hasValue(CSSValue* val) const
{
// FIXME: we should be implementing operator== to CSSValue and its derived classes
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
{
DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));
DEFINE_STATIC_LOCAL(const String, comma, (", "));
-
+
StringBuilder result;
result.reserveCapacity(32);
result.append(rectParen);
result.append(comma);
result.append(m_height->cssText());
-
+
if (m_radiusX.get()) {
result.append(comma);
result.append(m_radiusX->cssText());
result.append(m_radiusY->cssText());
}
}
-
+
result.append(')');
-
+
return result.toString();
}
{
DEFINE_STATIC_LOCAL(const String, circleParen, ("circle("));
DEFINE_STATIC_LOCAL(const String, comma, (", "));
-
+
StringBuilder result;
result.reserveCapacity(32);
result.append(circleParen);
result.append(m_radius->cssText());
result.append(')');
-
+
return result.toString();
}
{
DEFINE_STATIC_LOCAL(const String, ellipseParen, ("ellipse("));
DEFINE_STATIC_LOCAL(const String, comma, (", "));
-
+
StringBuilder result;
result.reserveCapacity(32);
result.append(ellipseParen);
result.append(m_radiusY->cssText());
result.append(')');
-
+
return result.toString();
}
DEFINE_STATIC_LOCAL(const String, polygonParenEvenOdd, ("polygon(evenodd, "));
DEFINE_STATIC_LOCAL(const String, polygonParenNonZero, ("polygon(nonzero, "));
DEFINE_STATIC_LOCAL(const String, comma, (", "));
-
+
StringBuilder result;
result.reserveCapacity(32);
if (m_windRule == RULE_EVENODD)
result.append(comma);
result.append(m_values.at(i + 1)->cssText());
}
-
+
result.append(')');
-
+
return result.toString();
}
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
CSS_WRAP_SHAPE_CIRCLE = 2,
CSS_WRAP_SHAPE_ELLIPSE = 3,
CSS_WRAP_SHAPE_POLYGON = 4,
- CSS_WRAP_SHAPE_PATH = 5
+ CSS_WRAP_SHAPE_PATH = 5
};
-
+
virtual Type type() = 0;
virtual String cssText() const = 0;
public:
virtual ~CSSWrapShape() { }
-
+
protected:
CSSWrapShape() { }
};
CSSPrimitiveValue* height() const { return m_height.get(); }
CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); }
CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); }
-
+
void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
void setTop(PassRefPtr<CSSPrimitiveValue> top) { m_top = top; }
void setWidth(PassRefPtr<CSSPrimitiveValue> width) { m_width = width; }
virtual Type type() { return CSS_WRAP_SHAPE_RECT; }
virtual String cssText() const;
-
+
private:
CSSWrapShapeRect() { }
-
+
RefPtr<CSSPrimitiveValue> m_top;
RefPtr<CSSPrimitiveValue> m_left;
RefPtr<CSSPrimitiveValue> m_width;
CSSPrimitiveValue* left() const { return m_left.get(); }
CSSPrimitiveValue* top() const { return m_top.get(); }
CSSPrimitiveValue* radius() const { return m_radius.get(); }
-
+
void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
void setTop(PassRefPtr<CSSPrimitiveValue> top) { m_top = top; }
void setRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_radius = radius; }
virtual Type type() { return CSS_WRAP_SHAPE_CIRCLE; }
virtual String cssText() const;
-
+
private:
CSSWrapShapeCircle() { }
-
+
RefPtr<CSSPrimitiveValue> m_top;
RefPtr<CSSPrimitiveValue> m_left;
RefPtr<CSSPrimitiveValue> m_radius;
CSSPrimitiveValue* top() const { return m_top.get(); }
CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); }
CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); }
-
+
void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
void setTop(PassRefPtr<CSSPrimitiveValue> top) { m_top = top; }
void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX; }
virtual Type type() { return CSS_WRAP_SHAPE_ELLIPSE; }
virtual String cssText() const;
-
+
private:
CSSWrapShapeEllipse() { }
-
+
RefPtr<CSSPrimitiveValue> m_top;
RefPtr<CSSPrimitiveValue> m_left;
RefPtr<CSSPrimitiveValue> m_radiusX;
class CSSWrapShapePolygon : public CSSWrapShape {
public:
static PassRefPtr<CSSWrapShapePolygon> create() { return adoptRef(new CSSWrapShapePolygon); }
-
+
void appendPoint(PassRefPtr<CSSPrimitiveValue> x, PassRefPtr<CSSPrimitiveValue> y)
- {
+ {
m_values.append(x);
m_values.append(y);
}
-
+
PassRefPtr<CSSPrimitiveValue> getXAt(unsigned i) { return m_values.at(i * 2); }
PassRefPtr<CSSPrimitiveValue> getYAt(unsigned i) { return m_values.at(i * 2 + 1); }
-
+
void setWindRule(WindRule w) { m_windRule = w; }
WindRule windRule() const { return m_windRule; }
-
+
virtual Type type() { return CSS_WRAP_SHAPE_POLYGON; }
virtual String cssText() const;
-
+
private:
CSSWrapShapePolygon()
: m_windRule(RULE_NONZERO)
{
}
-
+
Vector<RefPtr<CSSPrimitiveValue> > m_values;
- WindRule m_windRule;
+ WindRule m_windRule;
};
} // namespace WebCore
String FontValue::cssText() const
{
- // font variant weight size / line-height family
+ // font variant weight size / line-height family
String result("");
// FIXME: parsing can fail. The problem with failing constructor is that
// we would need additional flag saying MediaList is not valid
// Parse can fail only when fallbackToDescriptor == false, i.e when HTML4 media descriptor
- // forward-compatible syntax is not in use.
+ // forward-compatible syntax is not in use.
// DOMImplementationCSS seems to mandate that media descriptors are used
// for both html and svg, even though svg:style doesn't use media descriptors
// Currently the only places where parsing can fail are
}
}
}
-
+
if (!ec)
notifyChanged();
}
ec = SYNTAX_ERR;
return;
}
- }
+ }
} else if (!m_fallback) {
ec = SYNTAX_ERR;
return;
- }
+ }
}
// ",,,," falls straight through, but is not valid unless fallback
if (!m_fallback && list.begin() == list.end()) {
return;
}
}
-
+
ec = 0;
deleteAllValues(m_queries);
m_queries = tempMediaList->m_queries;
ec = 0;
}
}
-
+
if (!ec)
notifyChanged();
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
return result.toString();
}
-static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b)
+static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b)
{
return codePointCompare(a->serialize(), b->serialize()) < 0;
}
// if not all of the expressions is valid the media query must be ignored.
if (!m_ignored)
m_ignored = !m_expressions->at(i)->isValid();
-
+
if (m_expressions->at(i)->serialize() == key)
m_expressions->remove(i);
else
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MediaQuery_h
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MediaQueryEvaluator_h
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MediaQueryExp_h
bool isValid() const { return m_isValid; }
- bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature ||
- m_mediaFeature == MediaFeatureNames::heightMediaFeature ||
- m_mediaFeature == MediaFeatureNames::min_widthMediaFeature ||
- m_mediaFeature == MediaFeatureNames::min_heightMediaFeature ||
- m_mediaFeature == MediaFeatureNames::max_widthMediaFeature ||
- m_mediaFeature == MediaFeatureNames::max_heightMediaFeature ||
- m_mediaFeature == MediaFeatureNames::orientationMediaFeature ||
- m_mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature ||
- m_mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature ||
- m_mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature; }
+ bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature
+ || m_mediaFeature == MediaFeatureNames::heightMediaFeature
+ || m_mediaFeature == MediaFeatureNames::min_widthMediaFeature
+ || m_mediaFeature == MediaFeatureNames::min_heightMediaFeature
+ || m_mediaFeature == MediaFeatureNames::max_widthMediaFeature
+ || m_mediaFeature == MediaFeatureNames::max_heightMediaFeature
+ || m_mediaFeature == MediaFeatureNames::orientationMediaFeature
+ || m_mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
+ || m_mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature
+ || m_mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature; }
String serialize() const;
Pair() : m_first(0), m_second(0) { }
Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
: m_first(first), m_second(second) { }
-
+
RefPtr<CSSPrimitiveValue> m_first;
RefPtr<CSSPrimitiveValue> m_second;
};
Node* node = m_node.get();
if (!node)
return 0;
-
+
// Make sure our layout is up to date before we allow a query on these attributes.
if (updateLayout)
node->document()->updateLayout();
-
+
RenderStyle* style = node->computedStyle();
if (!style)
return 0;
-
+
const SVGRenderStyle* svgStyle = style->svgStyle();
if (!svgStyle)
return 0;
-
+
switch (static_cast<CSSPropertyID>(propertyID)) {
case CSSPropertyClipRule:
return CSSPrimitiveValue::create(svgStyle->clipRule());
break;
case CSSPropertyColorInterpolation: // auto | sRGB | linearRGB | inherit
- case CSSPropertyColorInterpolationFilters:
+ case CSSPropertyColorInterpolationFilters:
if (id == CSSValueAuto || id == CSSValueSrgb || id == CSSValueLinearrgb)
valid_primitive = true;
break;
m_valueList->next();
break;
-
+
case CSSPropertyVectorEffect: // none | non-scaling-stroke | inherit
if (id == CSSValueNone || id == CSSValueNonScalingStroke)
valid_primitive = true;
SVGRenderStyle* svgstyle = m_style->accessSVGStyle();
unsigned short valueType = value->cssValueType();
-
+
bool isInherit = m_parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT;
bool isInitial = valueType == CSSPrimitiveValue::CSS_INITIAL || (!m_parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT);
HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
if (!primitiveValue)
break;
-
+
svgstyle->setAlignmentBaseline(*primitiveValue);
break;
}
HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
if (!primitiveValue)
return;
-
- float f = 0.0f;
+
+ float f = 0.0f;
int type = primitiveValue->primitiveType();
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
f = primitiveValue->getFloatValue() / 100.0f;
HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
if (!primitiveValue)
return;
-
- float f = 0.0f;
+
+ float f = 0.0f;
int type = primitiveValue->primitiveType();
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
f = primitiveValue->getFloatValue() / 100.0f;
HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
if (!primitiveValue)
return;
-
- float f = 0.0f;
+
+ float f = 0.0f;
int type = primitiveValue->primitiveType();
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
f = primitiveValue->getFloatValue() / 100.0f;
s = primitiveValue->getStringValue();
else
return;
-
+
svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));
break;
}
// -webkit-svg-shadow does should not have a spread or style
ASSERT(!item->spread);
ASSERT(!item->style);
-
+
OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(x, y, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
svgstyle->setShadow(shadowData.release());
return;
#endif
namespace WebCore {
-
+
using namespace HTMLNames;
-
+
static bool htmlAttributeHasCaseInsensitiveValue(const QualifiedName& attr);
SelectorChecker::SelectorChecker(Document* document, bool strictParsing)
unsigned* hash = identifierHashes;
unsigned* end = identifierHashes + maximumIdentifierCount;
CSSSelector::Relation relation = selector->relation();
-
- // Skip the topmost selector. It is handled quickly by the rule hashes.
+
+ // Skip the topmost selector. It is handled quickly by the rule hashes.
bool skipOverSubselectors = true;
for (selector = selector->tagHistory(); selector; selector = selector->tagHistory()) {
// Only collect identifiers that match ancestors.
{
if (!node->isLink())
return 0;
-
+
ASSERT(node->isElementNode());
Element* element = static_cast<Element*>(node);
if (element->isHTMLElement())
return &element->fastGetAttribute(hrefAttr);
-
+
#if ENABLE(SVG)
if (element->isSVGElement())
return &element->getAttribute(XLinkNames::hrefAttr);
#endif
-
+
return 0;
}
EInsideLink SelectorChecker::determineLinkStateSlowCase(Element* element) const
{
ASSERT(element->isLink());
-
+
const AtomicString* attr = linkAttribute(element);
if (!attr || attr->isNull())
return NotInsideLink;
Frame* frame = m_document->frame();
if (!frame)
return InsideUnvisitedLink;
-
+
Page* page = frame->page();
if (!page)
return InsideUnvisitedLink;
-
+
m_linksCheckedForVisitedState.add(hash);
-
+
#if USE(PLATFORM_STRATEGIES)
return platformStrategies()->visitedLinkStrategy()->isLinkVisited(page, hash, m_document->baseURL(), *attr) ? InsideVisitedLink : InsideUnvisitedLink;
#else
}
if (topChildOrSubselector) {
// Child or subselector check failed.
- // If the match element is null, topChildOrSubselector was also the very topmost selector and had to match
+ // If the match element is null, topChildOrSubselector was also the very topmost selector and had to match
// the original element we were checking.
if (!topChildOrSubselectorMatchElement)
return false;
return false;
}
-inline bool checkClassValue(const Element* element, AtomicStringImpl* value, const QualifiedName&)
+inline bool checkClassValue(const Element* element, AtomicStringImpl* value, const QualifiedName&)
{
return element->hasClass() && static_cast<const StyledElement*>(element)->classNames().contains(value);
}
-inline bool checkIDValue(const Element* element, AtomicStringImpl* value, const QualifiedName&)
+inline bool checkIDValue(const Element* element, AtomicStringImpl* value, const QualifiedName&)
{
return element->hasID() && element->idForStyleResolution().impl() == value;
}
{
return true;
}
-
+
}
inline bool SelectorChecker::fastCheckRightmostSelector(const CSSSelector* selector, const Element* element, VisitedMatchType visitedMatchType) const
const Element* topChildOrSubselectorMatchElement = 0;
if (selector->relation() == CSSSelector::Child || selector->relation() == CSSSelector::SubSelector)
topChildOrSubselector = selector;
-
+
if (selector->relation() != CSSSelector::SubSelector)
element = element->parentElement();
-
+
selector = selector->tagHistory();
-
+
// We know this compound selector has descendant, child and subselector combinators only and all components are simple.
while (selector) {
switch (selector->m_match) {
// first selector has to match
if (!checkOneSelector(sel, e, dynamicPseudo, isSubSelector, visitedMatchType, elementStyle, elementParentStyle))
return SelectorFailsLocally;
-
+
// The rest of the selectors has to match
CSSSelector::Relation relation = sel->relation();
-
+
// Prepare next sel
sel = sel->tagHistory();
if (!sel)
// Bail-out if this selector is irrelevant for the pseudoStyle
if (m_pseudoStyle != NOPSEUDO && m_pseudoStyle != dynamicPseudo)
return SelectorFailsCompletely;
-
+
// Disable :visited matching when we see the first link or try to match anything else than an ancestors.
if (!isSubSelector && (e->isLink() || (relation != CSSSelector::Descendant && relation != CSSSelector::Child)))
visitedMatchType = VisitedMatchDisabled;
return match;
}
break;
- case CSSSelector::Child:
+ case CSSSelector::Child:
{
ContainerNode* n = e->parentNode();
if (!n || !n->isElementNode())
return checkSelector(sel, e, dynamicPseudo, false, visitedMatchType);
}
}
-
+
return SelectorFailsCompletely;
}
// This is the list of attributes in HTML 4.01 with values marked as "[CI]" or case-insensitive
// Mozilla treats all other values as case-sensitive, thus so do we.
HashSet<AtomicStringImpl*>* attrSet = new HashSet<AtomicStringImpl*>;
-
+
addLocalNameToSet(attrSet, accept_charsetAttr);
addLocalNameToSet(attrSet, acceptAttr);
addLocalNameToSet(attrSet, alignAttr);
addLocalNameToSet(attrSet, valignAttr);
addLocalNameToSet(attrSet, valuetypeAttr);
addLocalNameToSet(attrSet, vlinkAttr);
-
+
return attrSet;
}
const AtomicString& value = attributeItem->value();
if (value.isNull())
return false;
-
+
switch (match) {
case CSSSelector::Exact:
if (caseSensitive ? selectorValue != value : !equalIgnoringCase(selectorValue, value))
// Ignore empty selectors or selectors containing spaces
if (selectorValue.contains(' ') || selectorValue.isEmpty())
return false;
-
+
unsigned startSearchAt = 0;
while (true) {
size_t foundPos = value.find(selectorValue, startSearchAt, caseSensitive);
if (endStr == value.length() || value[endStr] == ' ')
break; // We found a match.
}
-
+
// No match. Keep looking.
startSearchAt = foundPos + 1;
}
default:
break;
}
-
+
return true;
}
{
for (size_t i = 0; i < attributes->length(); ++i) {
Attribute* attributeItem = attributes->attributeItem(i);
-
+
if (!SelectorChecker::attributeNameMatches(attributeItem, selectorAttr))
continue;
-
+
if (attributeValueMatches(attributeItem, match, selectorValue, caseSensitive))
return true;
}
-
+
return false;
}
ASSERT(e);
if (!SelectorChecker::tagMatches(e, sel))
return false;
-
+
if (sel->m_match == CSSSelector::Class)
return e->hasClass() && static_cast<StyledElement*>(e)->classNames().contains(sel->value());
-
+
if (sel->m_match == CSSSelector::Id)
return e->hasID() && e->idForStyleResolution() == sel->value();
-
+
if (sel->isAttributeSelector()) {
const QualifiedName& attr = sel->attribute();
-
+
NamedNodeMap* attributes = e->attributes(true);
if (!attributes)
return false;
-
+
bool caseSensitive = !m_documentIsHTML || !htmlAttributeHasCaseInsensitiveValue(attr);
-
+
if (!anyAttributeMatches(attributes, static_cast<CSSSelector::Match>(sel->m_match), attr, sel->value(), caseSensitive))
return false;
}
-
+
if (sel->m_match == CSSSelector::PseudoClass) {
// Handle :not up front.
if (sel->pseudoType() == CSSSelector::PseudoNot) {
if (sel->pseudoType() == CSSSelector::PseudoWindowInactive)
return !m_document->page()->focusController()->isActive();
}
-
+
// Normal element pseudo class checking.
switch (sel->pseudoType()) {
// Pseudo classes:
if (Element* parentElement = e->parentElement()) {
bool firstChild = false;
bool lastChild = false;
-
+
Node* n = e->previousSibling();
while (n && !n->isElementNode())
n = n->previousSibling();
}
n = n->previousSibling();
}
-
+
if (!m_isCollectingRulesOnly) {
RenderStyle* childStyle = elementStyle ? elementStyle : e->renderStyle();
RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle();
if (parentStyle)
parentStyle->setChildrenAffectedByForwardPositionalRules();
}
-
+
if (sel->matchNth(count))
return true;
}
count++;
n = n->previousSibling();
}
-
+
if (!m_isCollectingRulesOnly) {
RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle();
if (parentStyle)
parentStyle->setChildrenAffectedByForwardPositionalRules();
}
-
+
if (sel->matchNth(count))
return true;
}
break;
case CSSSelector::PseudoActive:
// If we're in quirks mode, then :active should never match anchors with no
- // href and *:active should not match anything.
+ // href and *:active should not match anything.
if (m_strictParsing || isSubSelector || (sel->hasTag() && !e->hasTagName(aTag)) || e->isLink()) {
if (elementStyle)
elementStyle->setAffectedByActiveRules(true);
if (!e || !e->isFormControlElement())
return false;
return e->isTextFormControl() && e->isReadOnlyFormControl();
- case CSSSelector::PseudoReadWrite:
+ case CSSSelector::PseudoReadWrite:
if (!e || !e->isFormControlElement())
return false;
return e->isTextFormControl() && !e->isReadOnlyFormControl();
}
#if ENABLE(FULLSCREEN_API)
case CSSSelector::PseudoFullScreen:
- // While a Document is in the fullscreen state, and the document's current fullscreen
- // element is an element in the document, the 'full-screen' pseudoclass applies to
- // that element. Also, an <iframe>, <object> or <embed> element whose child browsing
+ // While a Document is in the fullscreen state, and the document's current fullscreen
+ // element is an element in the document, the 'full-screen' pseudoclass applies to
+ // that element. Also, an <iframe>, <object> or <embed> element whose child browsing
// context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
if (e->isFrameElementBase() && static_cast<HTMLFrameElementBase*>(e)->containsFullScreenElement())
return true;
case CSSSelector::PseudoFullScreenAncestor:
return e->containsFullScreenElement();
case CSSSelector::PseudoFullScreenDocument:
- // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
+ // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
// to all elements of that Document.
if (!e->document()->webkitIsFullScreen())
return false;
if (sel->m_match == CSSSelector::PseudoElement) {
if (!elementStyle && !m_isCollectingRulesOnly)
return false;
-
+
if (sel->isUnknownPseudoElement()) {
m_hasUnknownPseudoElements = true;
return e->shadowPseudoId() == sel->value();
}
-
+
PseudoId pseudoId = CSSSelector::pseudoId(sel->pseudoType());
if (pseudoId == FIRST_LETTER) {
if (Document* document = e->document())
{
RenderScrollbar* scrollbar = RenderScrollbar::scrollbarForStyleResolve();
ScrollbarPart part = RenderScrollbar::partForStyleResolve();
-
+
// FIXME: This is a temporary hack for resizers and scrollbar corners. Eventually :window-inactive should become a real
// pseudo class and just apply to everything.
if (sel->pseudoType() == CSSSelector::PseudoWindowInactive)
return !m_document->page()->focusController()->isActive();
-
+
if (!scrollbar)
return false;
-
+
ASSERT(sel->m_match == CSSSelector::PseudoClass);
switch (sel->pseudoType()) {
case CSSSelector::PseudoEnabled:
return part == BackButtonStartPart || part == ForwardButtonStartPart || part == BackTrackPart;
case CSSSelector::PseudoEnd:
return part == BackButtonEndPart || part == ForwardButtonEndPart || part == ForwardTrackPart;
- case CSSSelector::PseudoDoubleButton:
+ case CSSSelector::PseudoDoubleButton:
{
ScrollbarButtonsPlacement buttonsPlacement = scrollbar->theme()->buttonsPlacement();
if (part == BackButtonStartPart || part == ForwardButtonStartPart || part == BackTrackPart)
if (part == BackButtonEndPart || part == ForwardButtonEndPart || part == ForwardTrackPart)
return buttonsPlacement == ScrollbarButtonsDoubleEnd || buttonsPlacement == ScrollbarButtonsDoubleBoth;
return false;
- }
+ }
case CSSSelector::PseudoSingleButton:
{
ScrollbarButtonsPlacement buttonsPlacement = scrollbar->theme()->buttonsPlacement();
unsigned SelectorChecker::determineLinkMatchType(const CSSSelector* selector)
{
unsigned linkMatchType = MatchAll;
-
+
// Statically determine if this selector will match a link in visited, unvisited or any state, or never.
// :visited never matches other elements than the innermost link element.
for (; selector; selector = selector->tagHistory()) {
EInsideLink determineLinkState(Element*) const;
void allVisitedStateChanged();
void visitedStateChanged(LinkHash visitedHash);
-
+
Document* document() const { return m_document; }
bool strictParsing() const { return m_strictParsing; }
-
+
bool isCollectingRulesOnly() const { return m_isCollectingRulesOnly; }
void setCollectingRulesOnly(bool b) { m_isCollectingRulesOnly = b; }
bool hasUnknownPseudoElements() const { return m_hasUnknownPseudoElements; }
void clearHasUnknownPseudoElements() { m_hasUnknownPseudoElements = false; }
-
+
static bool tagMatches(const Element*, const CSSSelector*);
static bool attributeNameMatches(const Attribute*, const QualifiedName&);
static bool isCommonPseudoClassSelector(const CSSSelector*);
bool matchesFocusPseudoClass(const Element*) const;
static bool fastCheckRightmostAttributeSelector(const Element*, const CSSSelector*);
static bool checkExactAttribute(const Element*, const QualifiedName& selectorAttributeName, const AtomicStringImpl* value);
-
+
enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink | MatchVisited };
static unsigned determineLinkMatchType(const CSSSelector*);
bool checkOneSelector(CSSSelector*, Element*, PseudoId& dynamicPseudo, bool isSubSelector, VisitedMatchType, RenderStyle*, RenderStyle* elementParentStyle) const;
bool checkScrollbarPseudoClass(CSSSelector*, PseudoId& dynamicPseudo) const;
static bool isFrameFocused(const Element*);
-
+
bool fastCheckRightmostSelector(const CSSSelector*, const Element*, VisitedMatchType) const;
bool commonPseudoClassSelectorMatches(const Element*, const CSSSelector*, VisitedMatchType) const;
return NotInsideLink;
return determineLinkStateSlowCase(element);
}
-
+
template <unsigned maximumIdentifierCount>
inline bool SelectorChecker::fastRejectSelector(const unsigned* identifierHashes) const
{
}
return false;
}
-
+
inline bool SelectorChecker::isCommonPseudoClassSelector(const CSSSelector* selector)
{
if (selector->m_match != CSSSelector::PseudoClass)
return true;
return element->focused() && isFrameFocused(element);
}
-
+
inline bool SelectorChecker::tagMatches(const Element* element, const CSSSelector* selector)
{
if (!selector->hasTag())
const AtomicString& namespaceURI = selector->tag().namespaceURI();
return namespaceURI == starAtom || namespaceURI == element->namespaceURI();
}
-
+
inline bool SelectorChecker::attributeNameMatches(const Attribute* attribute, const QualifiedName& selectorAttributeName)
{
if (selectorAttributeName.localName() != attribute->localName())
return false;
return selectorAttributeName.prefix() == starAtom || selectorAttributeName.namespaceURI() == attribute->namespaceURI();
}
-
+
inline bool SelectorChecker::checkExactAttribute(const Element* element, const QualifiedName& selectorAttributeName, const AtomicStringImpl* value)
{
NamedNodeMap* attributeMap = element->attributeMap();
}
return false;
}
-
+
inline bool SelectorChecker::fastCheckRightmostAttributeSelector(const Element* element, const CSSSelector* selector)
{
if (selector->m_match == CSSSelector::Exact || selector->m_match == CSSSelector::Set)
return sheet->finalURL();
if (sheet->parent())
return sheet->parent()->baseURL();
- if (!sheet->ownerNode())
+ if (!sheet->ownerNode())
return KURL();
return sheet->ownerNode()->document()->baseURL();
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef StyleMedia_h
// ### Bad implementation because returns a single element (are IDs always unique?)
// and doesn't look for name attribute.
// But unicity of stylesheet ids is good practice anyway ;)
-
+
Element* element = m_doc->getElementById(name);
if (element && element->hasTagName(styleTag))
return static_cast<HTMLStyleElement*>(element);
{
return m_doc;
}
-
+
private:
StyleSheetList(Document*);
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
default:
break;
}
-
+
return result + CSSValueList::cssText() + ")";
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebKitCSSFilterValue_h
virtual ~WebKitCSSFilterValue();
virtual String cssText() const;
-
+
FilterOperationType operationType() const { return m_type; }
-
+
private:
WebKitCSSFilterValue(FilterOperationType);
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
keys.clear();
Vector<String> strings;
s.split(',', strings);
-
+
for (size_t i = 0; i < strings.size(); ++i) {
float key = -1;
String cur = strings[i].stripWhiteSpace();
-
+
// For now the syntax MUST be 'xxx%' or 'from' or 'to', where xxx is a legal floating point number
if (cur == "from")
key = 0;
if (k >= 0 && k <= 100)
key = k/100;
}
-
+
if (key < 0) {
keys.clear();
return;
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebKitCSSKeyframeRule_h
String keyText() const { return m_key; }
void setKeyText(const String& s) { m_key = s; }
-
+
void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); }
CSSMutableStyleDeclaration* style() const { return m_style.get(); }
// Not part of the CSSOM
virtual bool parseString(const String&, bool = false);
-
+
void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>);
CSSMutableStyleDeclaration* declaration() { return m_style.get(); }
const CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
-
+
private:
virtual bool isKeyframeRule() const { return true; }
// Inherited from CSSRule
virtual CSSRuleType type() const { return WEBKIT_KEYFRAME_RULE; }
static void parseKeyString(const String& s, Vector<float>& keys);
-
+
WebKitCSSKeyframeRule(CSSStyleSheet* parent);
RefPtr<CSSMutableStyleDeclaration> m_style;
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
void WebKitCSSKeyframesRule::setName(const String& name)
{
m_name = name;
-
+
// Since the name is used in the keyframe map list in CSSStyleSelector, we need
// to recompute the style sheet to get the updated name.
if (stylesheet())
m_lstCSSRules->append(rule);
rule->setParent(this);
-
+
if (CSSMutableStyleDeclaration* style = rule->style())
style->setParent(this);
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebKitCSSKeyframesRule_h
String name() const;
void setName(const String&);
-
+
// This version of setName does not call styleSheetChanged to avoid
// unnecessary work. It assumes callers will either make that call
// themselves, or know that it will get called later.
void setNameInternal(const String& name)
- {
+ {
m_name = AtomicString(name);
}
virtual CSSRuleType type() const { return WEBKIT_KEYFRAMES_RULE; }
int findRuleIndex(const String& key) const;
-
+
RefPtr<CSSRuleList> m_lstCSSRules;
AtomicString m_name;
};
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
{
}
-WebKitCSSMatrix::WebKitCSSMatrix(const String& s, ExceptionCode& ec)
+WebKitCSSMatrix::WebKitCSSMatrix(const String& s, ExceptionCode& ec)
{
setMatrixValue(s, ec);
}
{
RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create();
if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, true)) {
- // Convert to TransformOperations. This can fail if a property
+ // Convert to TransformOperations. This can fail if a property
// requires style (i.e., param uses 'ems' or 'exs')
RefPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSPropertyWebkitTransform);
ec = SYNTAX_ERR;
return;
}
-
+
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
TransformationMatrix t;
return;
}
}
-
+
// set the matrix
m_matrix = t;
} else if (!string.isEmpty()) // There is something there but parsing failed
ec = NOT_SUPPORTED_ERR;
return 0;
}
-
+
return WebKitCSSMatrix::create(m_matrix.inverse());
}
{
if (isnan(rotX))
rotX = 0;
-
+
if (isnan(rotY) && isnan(rotZ)) {
rotZ = rotX;
rotX = 0;
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebKitCSSMatrix_h
{
return adoptRef(new WebKitCSSMatrix(s, ec));
}
-
+
virtual ~WebKitCSSMatrix();
double a() const { return m_matrix.a(); }
double d() const { return m_matrix.d(); }
double e() const { return m_matrix.e(); }
double f() const { return m_matrix.f(); }
-
+
void setA(double f) { m_matrix.setA(f); }
void setB(double f) { m_matrix.setB(f); }
void setC(double f) { m_matrix.setC(f); }
void setD(double f) { m_matrix.setD(f); }
void setE(double f) { m_matrix.setE(f); }
void setF(double f) { m_matrix.setF(f); }
-
+
double m11() const { return m_matrix.m11(); }
double m12() const { return m_matrix.m12(); }
double m13() const { return m_matrix.m13(); }
double m42() const { return m_matrix.m42(); }
double m43() const { return m_matrix.m43(); }
double m44() const { return m_matrix.m44(); }
-
+
void setM11(double f) { m_matrix.setM11(f); }
void setM12(double f) { m_matrix.setM12(f); }
void setM13(double f) { m_matrix.setM13(f); }
void setM42(double f) { m_matrix.setM42(f); }
void setM43(double f) { m_matrix.setM43(f); }
void setM44(double f) { m_matrix.setM44(f); }
-
+
void setMatrixValue(const String&, ExceptionCode&);
-
- // The following math function return a new matrix with the
+
+ // The following math function return a new matrix with the
// specified operation applied. The this value is not modified.
-
+
// Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix)
PassRefPtr<WebKitCSSMatrix> multiply(WebKitCSSMatrix* secondMatrix) const;
-
+
// Return the inverse of this matrix. Throw an exception if the matrix is not invertible
PassRefPtr<WebKitCSSMatrix> inverse(ExceptionCode&) const;
-
+
// Return this matrix translated by the passed values.
// Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations
// Operation is performed as though the this matrix is multiplied by a matrix with
// the translation values on the left (result = translation(x,y,z) * this)
PassRefPtr<WebKitCSSMatrix> translate(double x, double y, double z) const;
-
+
// Returns this matrix scaled by the passed values.
- // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN
+ // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN
// makes it the same as scaleX. This allows the 3D form to used for 2D operations
// Operation is performed as though the this matrix is multiplied by a matrix with
// the scale values on the left (result = scale(x,y,z) * this)
// Returns this matrix rotated by the passed values.
// If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX).
- // Otherwise use a rotation value of 0 for any passed NaN.
+ // Otherwise use a rotation value of 0 for any passed NaN.
// Operation is performed as though the this matrix is multiplied by a matrix with
// the rotation values on the left (result = rotation(x,y,z) * this)
PassRefPtr<WebKitCSSMatrix> rotate(double rotX, double rotY, double rotZ) const;
-
+
// Returns this matrix rotated about the passed axis by the passed angle.
// Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value
// Operation is performed as though the this matrix is multiplied by a matrix with
// the rotation values on the left (result = rotation(x,y,z,angle) * this)
PassRefPtr<WebKitCSSMatrix> rotateAxisAngle(double x, double y, double z, double angle) const;
-
+
// Return this matrix skewed along the X axis by the passed values.
// Passing a NaN will use a value of 0.
// Operation is performed as though the this matrix is multiplied by a matrix with
PassRefPtr<WebKitCSSMatrix> skewY(double angle) const;
const TransformationMatrix& transform() const { return m_matrix; }
-
+
String toString() const;
-
+
protected:
WebKitCSSMatrix(const TransformationMatrix&);
WebKitCSSMatrix(const String&, ExceptionCode&);
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
default:
break;
}
-
+
result += CSSValueList::cssText();
-
+
result += ")";
return result;
}
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebKitCSSTransformValue_h
virtual ~WebKitCSSTransformValue();
virtual String cssText() const;
-
+
TransformOperationType operationType() const { return m_type; }
-
+
private:
WebKitCSSTransformValue(TransformOperationType);