Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp

Issue 2607403002: Disallow setting invalid values for registered properties via CSSOM (Closed)
Patch Set: fix comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2007, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2007, 2010 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (marqueeStyle->getPropertyValue("width") == "auto" && 352 if (marqueeStyle->getPropertyValue("width") == "auto" &&
353 marqueeStyle->getPropertyValue("height") == "auto") { 353 marqueeStyle->getPropertyValue("height") == "auto") {
354 metrics.contentHeight = 0; 354 metrics.contentHeight = 0;
355 metrics.contentWidth = 0; 355 metrics.contentWidth = 0;
356 metrics.marqueeWidth = 0; 356 metrics.marqueeWidth = 0;
357 metrics.marqueeHeight = 0; 357 metrics.marqueeHeight = 0;
358 return metrics; 358 return metrics;
359 } 359 }
360 360
361 if (isHorizontal()) { 361 if (isHorizontal()) {
362 m_mover->style()->setProperty("width", "-webkit-max-content", "important", 362 m_mover->style()->setProperty(nullptr, "width", "-webkit-max-content",
363 ASSERT_NO_EXCEPTION); 363 "important", ASSERT_NO_EXCEPTION);
364 } else { 364 } else {
365 m_mover->style()->setProperty("height", "-webkit-max-content", "important", 365 m_mover->style()->setProperty(nullptr, "height", "-webkit-max-content",
366 ASSERT_NO_EXCEPTION); 366 "important", ASSERT_NO_EXCEPTION);
367 } 367 }
368 CSSStyleDeclaration* moverStyle = 368 CSSStyleDeclaration* moverStyle =
369 document().domWindow()->getComputedStyle(m_mover, String()); 369 document().domWindow()->getComputedStyle(m_mover, String());
370 370
371 metrics.contentWidth = moverStyle->getPropertyValue("width").toDouble(); 371 metrics.contentWidth = moverStyle->getPropertyValue("width").toDouble();
372 metrics.contentHeight = moverStyle->getPropertyValue("height").toDouble(); 372 metrics.contentHeight = moverStyle->getPropertyValue("height").toDouble();
373 metrics.marqueeWidth = marqueeStyle->getPropertyValue("width").toDouble(); 373 metrics.marqueeWidth = marqueeStyle->getPropertyValue("width").toDouble();
374 metrics.marqueeHeight = marqueeStyle->getPropertyValue("height").toDouble(); 374 metrics.marqueeHeight = marqueeStyle->getPropertyValue("height").toDouble();
375 375
376 if (isHorizontal()) { 376 if (isHorizontal()) {
377 m_mover->style()->setProperty("width", "", "important", 377 m_mover->style()->removeProperty("width", ASSERT_NO_EXCEPTION);
378 ASSERT_NO_EXCEPTION);
379 } else { 378 } else {
380 m_mover->style()->setProperty("height", "", "important", 379 m_mover->style()->removeProperty("height", ASSERT_NO_EXCEPTION);
381 ASSERT_NO_EXCEPTION);
382 } 380 }
383 381
384 return metrics; 382 return metrics;
385 } 383 }
386 384
387 HTMLMarqueeElement::AnimationParameters 385 HTMLMarqueeElement::AnimationParameters
388 HTMLMarqueeElement::getAnimationParameters() { 386 HTMLMarqueeElement::getAnimationParameters() {
389 AnimationParameters parameters; 387 AnimationParameters parameters;
390 Metrics metrics = getMetrics(); 388 Metrics metrics = getMetrics();
391 389
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 String::numberToStringECMAScript(value) + "px)"; 489 String::numberToStringECMAScript(value) + "px)";
492 } 490 }
493 491
494 DEFINE_TRACE(HTMLMarqueeElement) { 492 DEFINE_TRACE(HTMLMarqueeElement) {
495 visitor->trace(m_mover); 493 visitor->trace(m_mover);
496 visitor->trace(m_player); 494 visitor->trace(m_player);
497 HTMLElement::trace(visitor); 495 HTMLElement::trace(visitor);
498 } 496 }
499 497
500 } // namespace blink 498 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698